Re: Global variables and id lookup for elements

On Jul 19, 2011, at 6:47 PM, Boris Zbarsky wrote:

> 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.

There we two bugs in this regard in the original ES5 spec, one related to function declarations and the other related to var declarations.  Functions were partially fixed in the ES5.1 specification but that fix still had a problem in that it did a GetProperty rather than a GetOwnProperty  when check to see if a function has been declared on the global object.  None of the corresponding fix for vars make it into the 5.1 spec. Both 5.1 corrections were described by me on the es5-discuss mailing list this past January.  Those fixes will be included in the first Errata for ES5.1.

The relevant message with the algorithm correction is https://mail.mozilla.org/pipermail/es5-discuss/2011-January/003882.html 

Allen

Received on Wednesday, 20 July 2011 02:44:54 UTC