Note that there are some explanatory texts on larger screens.

plurals
  1. POIE8 strange behavior, my problem or bug?
    text
    copied!<p>OK guys this is intreting,</p> <p>I'm testing this page</p> <p><a href="http://static.nemesisdesign.net/demos/ie8-strange/test.html" rel="nofollow">http://static.nemesisdesign.net/demos/ie8-strange/test.html</a></p> <p>on IE8 / windows XP.</p> <p>This is the code:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8" /&gt; &lt;meta http-equiv="content-language" content="en"&gt; &lt;title&gt;Test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="thisgivesmeanerror"&gt;test&lt;/div&gt; &lt;script&gt; thisgivesmeanerror = 'test'; alert('this alert won\'t be fired on my IE8, what about yours?'); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>If I open this page with IE8 I get an error. If I change the code of the script to:</p> <pre><code>&lt;script&gt; // note that I added var prefix var thisgivesmeanerror = 'test'; alert('this alert won\'t be fired on my IE8, what about yours?'); &lt;/script&gt; </code></pre> <p>It works fine. This happens only on IE 7/8, didn't test it on IE6.</p> <p>What do you think? Does it happen to you also? Or is it just my browser that has gone crazy?</p> <h2>Addition</h2> <p>You're saying that is just not using the var prefix that cause the error? I'm sorry guys but you're wrong, you didn't take time to test the code.</p> <p>I uploaded a test2 page <a href="http://static.nemesisdesign.net/demos/ie8-strange/test2.html" rel="nofollow">http://static.nemesisdesign.net/demos/ie8-strange/test2.html</a> with the follwing cocde</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8" /&gt; &lt;meta http-equiv="content-language" content="en"&gt; &lt;title&gt;Test 2&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="thisgivesmeanerror"&gt;test&lt;/div&gt; &lt;script&gt; thisdoesntgiveanyerror = 'test'; alert('This alert will be fired correcly'); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>That works fine.</p> <p>So what is actually causing the error? The variable name without the var prefix having the same name as the ID of the DIV element.</p> <p>Isn't this strange?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload