Last Comment Bug 665894 - HTMLCollection with expandos gets confused about element ids
: HTMLCollection with expandos gets confused about element ids
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: x86 Mac OS X
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
Depends on: 648801
  Show dependency treegraph
Reported: 2011-06-21 07:52 PDT by David Flanagan [:djf]
Modified: 2014-01-16 08:20 PST (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

An HTML file that demonstrates the bug (683 bytes, text/html)
2011-06-21 07:52 PDT, David Flanagan [:djf]
no flags Details

Description David Flanagan [:djf] 2011-06-21 07:52:14 PDT
Created attachment 540751 [details]
An HTML file that demonstrates the bug

If I obtain an HTMLCollection, and then set an expando on it, then set the id of one of the contained elements to match the expando, the HTMLCollection then returns the element rather than the value of the expando when I index it with that name.

But things go wrong when I change the id of that element to something else. Indexing the collection with the expando name now ought to return the expando value, but instead it still returns the element, even though the element no longer has that id.

See the attachment for code that demonstrates the bug.  I've tested it in FF 5 and Aurora 6.0a2 (2011-06-20)
Comment 1 Boris Zbarsky [:bz] (TPAC) 2011-06-21 09:28:28 PDT
This is a duplicate.
Comment 2 David Flanagan [:djf] 2011-06-21 09:34:40 PDT
Sorry for the dupe.  I didn't see anything like it in Bugzilla, but I haven't figured out how to search Bugzilla well yet.

Would you link to the existing bug?
Comment 3 Boris Zbarsky [:bz] (TPAC) 2011-06-21 10:00:51 PDT
If I knew the bug# offhand I would have marked this a duplicate...  I'd have to search for it.  In any case, this will go away with the new DOM bindings.
Comment 4 Peter Van der Beken [:peterv] 2011-08-17 06:13:24 PDT
Bug 648801 fixes this somewhat, except that it favors expandos over contained elements to match the WebIDL spec (see in particular step 4).
Comment 5 Peter Van der Beken [:peterv] 2011-08-17 06:34:48 PDT
Although I guess technically objects that don't have a name creator/setter operation shouldn't support setting of expandos.
Comment 6 Boris Zbarsky [:bz] (TPAC) 2011-08-23 22:14:11 PDT
No, I think expandos should work....  In particular, setting anything outside the set of supported names should just set an expando, no?
Comment 7 Boris Zbarsky [:bz] (TPAC) 2011-10-12 11:41:48 PDT
So is this fixed now that bug 648801 is fixed?
Comment 8 David Flanagan [:djf] 2011-10-12 14:59:19 PDT
Works for me in Nightly. (But as peterv points out, the behavior has changed to track WebIDL, and expandos always always shadow named elements.)  

Setting status to  RESOLVED FIXED

Note You need to log in before you can comment on or make changes to this bug.