Closed Bug 1223716 Opened 9 years ago Closed 9 years ago

Consistently check for HTML namespace around any name attribute operations in HTMLCollection

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: annevk, Assigned: bzbarsky)

Details

Attachments

(1 file)

See https://github.com/whatwg/dom/issues/104 for details and demos/tests as well as a link to a change to the DOM Standard (where it was inconsistent too until today).
Anne, this includes web platform test changes, since I needed to add tests anyway....
Attachment #8686262 - Flags: review?(bkelly)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8686262 [details] [diff] [review]
Make HTMLCollection check for the element being HTML before checking for its name inside its named getter

Review of attachment 8686262 [details] [diff] [review]:
-----------------------------------------------------------------

r=me, although I don't understand the spec well enough to verify the premise that the name attribute is only valid in the HTML namespace.  I'm trusting thats correct.
Attachment #8686262 - Flags: review?(bkelly) → review+
https://hg.mozilla.org/mozilla-central/rev/8f9702898548
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
One small question: order for supported property names (ID and names) for some methods, like Object.getOwnPropertyNames(), should be the same what we see in DevTools? Small testcase:

<!DOCTYPE html>
<html>
<body>
    <div id="contener">
        <p name="test">P1 (name="test") in DIV.</p>
        <p id="test">P2 (id="test") in DIV.</p>
        <p id="Test">P3 (id="Test") in DIV.</p>
        <p name="Test">P4 (name="Test") in DIV.</p>
    </div>
    <script>
        var collection = contener.children;
        console.log(collection);
        console.log(Object.getOwnPropertyNames(collection));
    </script>
</body>
</html>

And results:
DevTools: Test:<p#Test> test:<p>
this is <p id="Test">P3 (id="Test") in DIV.</p> and <p name="test">P1 (name="test") in DIV.</p>

getOwnPropertyNames(): Array [ "0", "1", "2", "3", "test", "Test" ]
this is <p name="test">P1 (name="test") in DIV.</p> and <p id="Test">P3 (id="Test") in DIV.</p>

Or DevTools are specific case and we should not to pay attention to the order in this place? I check this in Chrome and see similar behavior (reverse ordering for P when we comparing to getOwnPropertyNames() and additionally length attribute is in different place).
> should be the same what we see in DevTools?

What I see in devtools for your testcase is:

  HTMLCollection [ <p>, <p#test>, <p#Test>, <p> ]

That is, it's trying to show the items in the list somewhat nicely, and hence shows id attributes in addition to tag names when prettyprinting a node.  Past that, I'm really not sure what you're asking.
Yes, I was not precise, I mean that one result came from devtools (in Console bookmark) and second result came from devtools (also in the Console bookmark, but in right additional panel, when we click on HTMLCollection object to explore it). When object has more fields then we don't see all of them (get only short version + infos like "xxx more...") and must click on them to see all of this fields. And in this right panel we don't receive the same order of the object fields what we see in left panel (as for my example).

I don't know if it's intentional, but such inconsistency introduces a slight confusion. Is there any option for devtools to show all object fields, without using right panel? I want always dispaly full version of object fields in basic Console bookmark or do it occasionally (via clicking on object + some keys or other solution which will allow to do this).
That's a question for the devtools people.  I have no idea what their UX goals are....  #devtools on IRC.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: