W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2014

[Bug 24624] New: Is the order of HTMLCollection's supported property names valid?

From: <bugzilla@jessica.w3.org>
Date: Tue, 11 Feb 2014 22:05:51 +0000
To: www-dom@w3.org
Message-ID: <bug-24624-4009@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24624

            Bug ID: 24624
           Summary: Is the order of HTMLCollection's supported property
                    names valid?
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DOM
          Assignee: annevk@annevk.nl
          Reporter: dchris@gmail.com
        QA Contact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, www-dom@w3.org

The current dom spec says at:
http://dom.spec.whatwg.org/#interface-htmlcollection

"""
The supported property names are the values from the list returned by these
steps:

    1. Let result be an empty list.

    2. For each element represented by the collection, in tree order, run these
substes:

      1. If element is in the HTML namespace and has a name attribute whose
value is neither the empty string nor is in result, append element's name
attribute value to result.

      2. If element has an ID which is neither the empty string nor is in
result, append element's ID to result. 

    3. Return result. 
"""

This means that when an element contributes both its id and name, the name will
precede the id in result. This seems odd because this is the opposite behavior
of HTMLCollection subclasses:
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#collections-0

The HTML5 spec for these collections always indicates:
"with the id of an element preceding its name if it contributes both".

Behavior of existing browsers:
- Firefox 27 has the id preceding the name (see http://jsfiddle.net/59wrt/2/)
- IE11 does not return the Element's id if the Element contributes its name :(
- Chrome. This is not supported yet in stable releases but I have recently
implemented this as per the spec
(http://code.google.com/p/chromium/issues/detail?id=341269). For
HTMLCollection, the name precedes the id. For HTMLCollection subclasses the id
precedes the name. However, this has not shipped yet so there is still time to
fix it if the spec gets updated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Received on Tuesday, 11 February 2014 22:05:53 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:22 UTC