Re: Global variables and id lookup for elements

On 7/19/11 7:43 PM, Ian Hickson wrote:
> On Thu, 28 Apr 2011, Magnus Kristiansen wrote:
>>
>> Context: http://krijnhoetmer.nl/irc-logs/whatwg/20110428#l-707
>>
>> Current browsers disagree about how to handle<div
>> id=x></div><script>var x;</script>. Webkit browsers leave x pointing to
>> the div, whereas IE, Firefox and Opera make x undefined [1]. (There is
>> content that depends on x being undefined, but I don't have any links
>> handy right now.)
>>
>> My reading of the relevant specs (es5 section 10, WebIDL 4.5.3, HTML
>> 6.2.4) supports the Webkit behavior

> Is this still something I should do, or did this get resolved using
> another solution?

Unclear.  For one thing, the ES5 spec on this has changed, and there is 
no public draft with the errata yet; they're only present in the form of 
e-mails.  That makes it hard for me to say at this point whether the 
above claim is even true.

That said, even if we ignore the behavior of var, that leaves open 
questions about what happens on assignment, etc.  I do think Cameron has 
done a bunch of testing of this stuff recently, and there was a data 
table that summarized the results somewhere.  You should probably just 
talk to him about it.

-Boris

Received on Wednesday, 20 July 2011 01:48:28 UTC