W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

Re: Global variables and id lookup for elements

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Wed, 20 Jul 2011 07:55:14 -0700
Cc: Boris Zbarsky <bzbarsky@MIT.EDU>, Ian Hickson <ian@hixie.ch>, Magnus Kristiansen <magnusrk+w3c@pvv.org>, Cameron McCormack <cam@mcc.id.au>, public-webapps@w3.org, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-Id: <D1C8A646-398D-41E9-9480-66724A690393@wirfs-brock.com>
To: Allen Wirfs-Brock <allen@wirfs-brock.com>
To follow up, this issue is https://bugs.ecmascript.org/show_bug.cgi?id=78 

On Jul 19, 2011, at 7:44 PM, Allen Wirfs-Brock wrote:

> 
> 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 14:55:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC