4 <script src=
"../../resources/js-test.js"></script>
6 <a href=
"#" id=
"aId1" name=
"aName1"></a>
7 <map id=
"mapId1" name=
"mapName1">
8 <area shape=
"rect" coords=
"0,0,82,126" href=
"#" id=
"areaId1" name=
"areaName1"/>
9 <area shape=
"circle" coords=
"90,58,3" href=
"#" id=
"areaId2" name=
"areaName2"/>
11 <embed src=
"#" id=
"embedId1" name=
"embedName1">
12 <form id=
"formId1" name=
"formName1">
13 <input id=
"inputId1" name=
"inputName1"></input>
14 <input id=
"inputId2"></input>
16 <iframe id=
"iframeId1" name=
"iframeName1"></iframe>
17 <img id=
"imgId8" name=
"imgName8"/>
18 <object width=
"0" height=
"0" data=
"#" id=
"objectId1" name=
"objectName1"></object>
19 <select id=
"selectId1" name=
"selectName1">
20 <option value=
"option" id=
"optionId1" name=
"optionName1">option
</option>
24 description("This tests verifies the enumerated properties on HTMLAllCollection and their order.");
26 var htmlAllCollection
= document
.all
;
27 shouldBe("htmlAllCollection.__proto__", "HTMLAllCollection.prototype");
28 shouldBe("htmlAllCollection.__proto__.__proto__", "HTMLCollection.prototype");
29 shouldBe("htmlAllCollection.length", "34");
31 // As per http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlallcollection-0:
32 // The supported property names consist of the non-empty values of all the id attributes of all the elements
33 // represented by the collection, and the non-empty values of all the name attributes of all the a, area,
34 // embed, form, frame, frameset, iframe, img, and object elements represented by the collection, in tree order,
35 // ignoring later duplicates, with the id of an element preceding its name if it contributes both, they differ from
36 // each other, and neither is the duplicate of an earlier entry.
37 var expectedEnumeratedProperties
= ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "length", "description", "console", "aId1", "aName1", "mapId1", "areaId1", "areaName1", "areaId2", "areaName2", "embedId1", "embedName1", "formId1", "formName1", "inputId1", "inputName1", "inputId2", "iframeId1", "iframeName1", "imgId8", "imgName8", "objectId1", "objectName1", "selectId1", "selectName1", "optionId1", "item", "namedItem"].sort();
39 var enumeratedProperties
= [];
40 for (var property
in htmlAllCollection
) {
41 enumeratedProperties
[enumeratedProperties
.length
] = property
;
43 enumeratedProperties
.sort();
44 shouldBe("enumeratedProperties", "expectedEnumeratedProperties");