This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 6036 - HTMLCollection.namedItem() should look for non-HTML elements
Summary: HTMLCollection.namedItem() should look for non-HTML elements
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
Depends on:
Reported: 2008-09-07 14:32 UTC by Simon Pieters
Modified: 2010-10-04 13:57 UTC (History)
4 users (show)

See Also:


Description Simon Pieters 2008-09-07 14:32:27 UTC
The spec says about HTMLCollection.namedItem():

"It is an HTML element of any kind with an id attribute equal to key. (Non-HTML elements, even if they have IDs, are not searched for the purposes of namedItem().)"

I think this should be changed to look for non-HTML elements too. It already does in Opera and Firefox (not WebKit). There's a .children attribute on Element that returns HTMLCollection and I think it would be silly if namedItem only worked for HTML elements.
Comment 1 Anne 2008-09-07 22:13:41 UTC
Should it still look just at id attributes in that case though? Or ID attributes?
Comment 2 Simon Pieters 2008-09-08 11:44:46 UTC
I don't really care either way. (Or well, I'd *like* XML ID 5 that makes all 'id' attributes of type ID.)

Firefox looks at 'id' attributes on any element. Opera looks at 'id' attributes on HTML and SVG elements.