Re: Serious concerns about: dom-window-nameditem

On 8 July 2010 16:26, Anne van Kesteren <annevk@opera.com> wrote:

> On Thu, 08 Jul 2010 16:02:37 +0200, Stephen Cunliffe <
> stephen.cunliffe@gmail.com> wrote:
>
>> http://dev.w3.org/html5/spec/Overview.html#dom-window-nameditem
>>
>> The "double-speak" of the spec makes it difficult to digest, but if I
>> understand the intentions correctly, the idea is to now propagate this
>> pollution of the global namespace to EVERY browser including the merging
>> of ID/NAME attribute values into this global set.
>>
>
> Most browsers have implemented this long ago for compatibility reasons and
> therefore we have to keep it unfortunately.
>

The spec seems to go further than current browser implementation, though.
For instance (http://jsbin.com/awato), neither Firefox nor Chrome dumps all
named anchors on the window object; Firefox doesn't dump all named images on
the window object (I'm surprised Chrome does, but Chrome throws more bones
to rubbish IE-specific code than Firefox does). But I assume the goal in
including those is to make the rules straightforward.

I agree with Stephen that it's not a great idea to codify this broken IE
behavior (I don't find the fact that some browsers half-implement it
remotely compelling), but at the same time, I can't get too worked up about
it. :-) You have to code around it anyway (unless you're in some nirvana
where you don't have to support IE). So long as the spec doesn't allow IE's
crazy-wrong behavior including these named elements in the results from
document.getElementById (which even Microsoft has seen the light on).

Could you explain how the specification is unclear? We certainly do not want
> "double-speak" in the normative user agent requirements!
>

Agreed. FWIW, the section that Stephen linked to seemed clear to me.
--
T.J. Crowder
tj@crowdersoftware.com
Independent Software Consultant

Received on Thursday, 8 July 2010 16:19:40 UTC