OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <link rel=help href=https://dom.spec.whatwg.org/#interface-htmlcollection> | 3 <link rel=help href=https://dom.spec.whatwg.org/#interface-htmlcollection> |
4 <script src=/resources/testharness.js></script> | 4 <script src=/resources/testharness.js></script> |
5 <script src=/resources/testharnessreport.js></script> | 5 <script src=/resources/testharnessreport.js></script> |
6 | 6 |
7 <div id=log></div> | 7 <div id=log></div> |
8 | 8 |
9 <!-- with no attribute --> | 9 <!-- with no attribute --> |
10 <span></span> | 10 <span></span> |
11 | 11 |
12 <!-- with `id` attribute --> | 12 <!-- with `id` attribute --> |
13 <span id=''></span> | 13 <span id=''></span> |
14 <span id='some-id'></span> | 14 <span id='some-id'></span> |
15 <span id='some-id'></span><!-- to ensure no duplicates --> | 15 <span id='some-id'></span><!-- to ensure no duplicates --> |
16 | 16 |
17 <!-- with `name` attribute --> | 17 <!-- with `name` attribute --> |
18 <span name=''></span> | 18 <span name=''></span> |
19 <span name='some-name'></span> | 19 <span name='some-name'></span> |
20 <span name='some-name'></span><!-- to ensure no duplicates --> | 20 <span name='some-name'></span><!-- to ensure no duplicates --> |
21 | 21 |
22 <!-- with `name` and `id` attribute --> | 22 <!-- with `name` and `id` attribute --> |
23 <span id='another-id' name='another-name'></span> | 23 <span id='another-id' name='another-name'></span> |
24 | 24 |
25 <script> | 25 <script> |
26 test(function () { | 26 test(function () { |
27 var elements = document.getElementsByTagName("span"); | 27 var elements = document.getElementsByTagName("span"); |
28 assert_array_equals( | 28 assert_array_equals( |
29 Object.getOwnPropertyNames(elements), | 29 Object.getOwnPropertyNames(elements), |
30 ['0', '1', '2', '3', '4', '5', '6', '7', 'some-id', 'some-name', 'another-id
', 'another-name'] | 30 ['0', '1', '2', '3', '4', '5', '6', '7', 'some-id', 'some-name', 'another-id
', 'another-name'] |
31 ); | 31 ); |
32 }, 'Object.getOwnPropertyNames on HTMLCollection'); | 32 }, 'Object.getOwnPropertyNames on HTMLCollection'); |
(...skipping 12 matching lines...) Expand all Loading... |
45 var elem = document.createElement('foo'); | 45 var elem = document.createElement('foo'); |
46 this.add_cleanup(function () {elem.remove();}); | 46 this.add_cleanup(function () {elem.remove();}); |
47 document.body.appendChild(elem); | 47 document.body.appendChild(elem); |
48 | 48 |
49 var elements = document.getElementsByTagName("foo"); | 49 var elements = document.getElementsByTagName("foo"); |
50 elements.someProperty = "some value"; | 50 elements.someProperty = "some value"; |
51 | 51 |
52 assert_array_equals(Object.getOwnPropertyNames(elements), ['0', 'someProperty'
]); | 52 assert_array_equals(Object.getOwnPropertyNames(elements), ['0', 'someProperty'
]); |
53 }, 'Object.getOwnPropertyNames on HTMLCollection with expando object'); | 53 }, 'Object.getOwnPropertyNames on HTMLCollection with expando object'); |
54 </script> | 54 </script> |
OLD | NEW |