Quantcast

should window.foo return a HTMLCollection if div id=foo and form name=foo exist?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

should window.foo return a HTMLCollection if div id=foo and form name=foo exist?

Martin Honnen-3
Hi,

the test case
http://home.arcor.de/martin.honnen/javascript/2012/test2012111502.html 
has <div id="foo">...</div> and <form name="foo">...</form>.

In that case according to
http://www.w3.org/TR/html5/browsers.html#named-access-on-the-window-object 
I think that
   window.foo
should a return a HTMLCollection containing both the div and the form
element.

However with Firefox (tested both with release 16.0.2 and nightly 18.0a2
(2012-11-14) on Windows 7) I have two problems, first the access to
   window.foo
yields undefined, then an access to the unqualified
   foo
yields a single HTMLDivElement, then suddenly the access to
   window.foo
is no longer undefined but gives the HTMLDivElement as well.

So two questions, why is "window.foo" first undefined and suddenly
defined after an access to "foo"?

And shouldn't "window.foo" as well as "foo" not return a HTMLCollection?
Chrome (tested with 23.0.1271.64) and Opera (tested with 12.10) do that.

Regards

Martin
_______________________________________________
dev-tech-dom mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-dom
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: should window.foo return a HTMLCollection if div id=foo and form name=foo exist?

Boris Zbarsky
On 11/15/12 6:29 AM, Martin Honnen wrote:
> So two questions, why is "window.foo" first undefined and suddenly
> defined after an access to "foo"?

Because we used to only do global scope pollution on unqualified
lookups.  I suggest retesting in a nightly build.

> And shouldn't "window.foo" as well as "foo" not return a HTMLCollection?

At the moment, our gsp implementation does the bare minimum needed for
web compat (given that we only recently gave up on trying to get this
removed from the spec in the first place).  If someone wants to make it
more complicated to match the spec here, I'm happy to review the patch,
but otherwise it's a low priority, since this entire "feature" is
completely broken by design and bad for the web to start with....

-Boris
_______________________________________________
dev-tech-dom mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-dom
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: should window.foo return a HTMLCollection if div id=foo and form name=foo exist?

Martin Honnen-3
Boris Zbarsky wrote:
> On 11/15/12 6:29 AM, Martin Honnen wrote:
>> So two questions, why is "window.foo" first undefined and suddenly
>> defined after an access to "foo"?
>
> Because we used to only do global scope pollution on unqualified
> lookups.  I suggest retesting in a nightly build.

Is Aurora 18.0a2 (2012-11-14) not a nightly? With that I see the output


window.foo

window.foo: undefined
foo

foo: [object HTMLDivElement]
window.foo

window.foo: [object HTMLDivElement]




_______________________________________________
dev-tech-dom mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-dom
Loading...