Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: LayoutTests/fast/dom/htmlcollection-enumerated-properties.html

Issue 157813013: Update the order of named properties on HTMLCollection objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reup Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/html/HTMLCollection.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 <a id="id1" name="name1"></a> 5 <a id="id1" name="name1"></a>
6 <a id="id2" name="name1"></a> 6 <a id="id2" name="name1"></a>
7 <a id="id3"></a> 7 <a id="id3"></a>
8 <a id="id4" name="name4"></a> 8 <a id="id4" name="name4"></a>
9 <a name="name5"></a> 9 <a name="name5"></a>
10 <a id="id4" name="name6"></a> 10 <a id="id4" name="name6"></a>
11 11
12 <script> 12 <script>
13 description("This tests verifies the enumerated properties on HTMLCollection and their order."); 13 description("This tests verifies the enumerated properties on HTMLCollection and their order.");
14 14
15 var testLink = document.getElementById("testLink"); 15 var testLink = document.getElementById("testLink");
16 var htmlCollection = document.getElementsByTagName("a"); 16 var htmlCollection = document.getElementsByTagName("a");
17 shouldBe("htmlCollection.__proto__", "HTMLCollection.prototype"); 17 shouldBe("htmlCollection.__proto__", "HTMLCollection.prototype");
18 shouldBe("htmlCollection.length", "6"); 18 shouldBe("htmlCollection.length", "6");
19 19
20 // As per http://dom.spec.whatwg.org/#htmlcollection: 20 // As per http://dom.spec.whatwg.org/#htmlcollection:
21 // - The object's supported property indices are the numbers in the range zero t o one less than the 21 // - The object's supported property indices are the numbers in the range zero t o one less than the
22 // number of nodes represented by the collection. If there are no such element s, then there are no 22 // number of nodes represented by the collection. If there are no such element s, then there are no
23 // supported property indices. 23 // supported property indices.
24 // - The supported property names are the values from the list returned by these steps: 24 // - The supported property names are the values from the list returned by these steps:
25 // 1. Let result be an empty list. 25 // 1. Let result be an empty list.
26 // 2. For each element represented by the collection, in tree order, run these substeps: 26 // 2. For each element represented by the collection, in tree order, run these substeps:
27 // 1. If element is in the HTML namespace and has a name attribute whose v alue is neither the empty string 27 // 1. If element has an ID which is neither the empty string nor is in res ult, append element's ID to result.
28 // 2. If element is in the HTML namespace and has a name attribute whose v alue is neither the empty string
28 // nor is in result, append element's name attribute value to result. 29 // nor is in result, append element's name attribute value to result.
29 // 2. If element has an ID which is neither the empty string nor is in res ult, append element's ID to result.
30 // 3. Return result. 30 // 3. Return result.
31 var expectedEnumeratedProperties = ["0", "1" , "2", "3", "4", "5", "length", "na me1", "id1", "id2", "id3", "name4", "id4", "name5", "name6", "item", "namedItem" ]; 31 var expectedEnumeratedProperties = ["0", "1" , "2", "3", "4", "5", "length", "id 1", "name1", "id2", "id3", "id4", "name4", "name5", "name6", "item", "namedItem" ];
32 32
33 var enumeratedProperties = []; 33 var enumeratedProperties = [];
34 for (var property in htmlCollection) { 34 for (var property in htmlCollection) {
35 enumeratedProperties[enumeratedProperties.length] = property; 35 enumeratedProperties[enumeratedProperties.length] = property;
36 } 36 }
37 shouldBe("enumeratedProperties", "expectedEnumeratedProperties"); 37 shouldBe("enumeratedProperties", "expectedEnumeratedProperties");
38 </script> 38 </script>
39 </body> 39 </body>
40 </html> 40 </html>
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/HTMLCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698