OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src='../resources/testharness.js'></script> | 2 <script src='../resources/testharness.js'></script> |
3 <script src='../resources/testharnessreport.js'></script> | 3 <script src='../resources/testharnessreport.js'></script> |
4 <script src='resources/shadow-dom.js'></script> | 4 <script src='resources/shadow-dom.js'></script> |
5 <div id='host'> | 5 <div id='host'> |
6 <template data-mode='open'> | 6 <template data-mode='open'> |
7 <slot id='slot1'></slot> | 7 <slot id='slot1'></slot> |
8 <slot id='slot2'></slot> | 8 <slot id='slot2'></slot> |
9 <slot id='slot3' name='slot3'></slot> | 9 <slot id='slot3' name='slot3'></slot> |
10 </template> | 10 </template> |
11 <div id='child1' slot='nonexistent'></div> | 11 <div id='child1' slot='nonexistent'></div> |
12 <div id='child2'></div> | 12 <div id='child2'></div> |
13 <div id='child3' slot='slot3'></div> | 13 <div id='child3' slot='slot3'></div> |
14 <div id='child4'></div> | 14 <div id='child4'></div> |
15 </div> | 15 </div> |
16 <script> | 16 <script> |
17 'use strict'; | 17 'use strict'; |
18 convertTemplatesToShadowRootsWithin(host); | 18 convertTemplatesToShadowRootsWithin(host); |
19 removeWhiteSpaceOnlyTextNodes(host); | 19 removeWhiteSpaceOnlyTextNodes(host); |
20 document.body.offsetLeft; | |
21 | 20 |
22 const slot1 = host.shadowRoot.querySelector('#slot1'); | 21 const slot1 = host.shadowRoot.querySelector('#slot1'); |
23 const slot2 = host.shadowRoot.querySelector('#slot2'); | 22 const slot2 = host.shadowRoot.querySelector('#slot2'); |
24 const slot3 = host.shadowRoot.querySelector('#slot3'); | 23 const slot3 = host.shadowRoot.querySelector('#slot3'); |
25 | 24 |
26 test(() => { | 25 test(() => { |
27 assert_equals(child1.assignedSlot, null); | 26 assert_equals(child1.assignedSlot, null); |
28 assert_equals(child2.assignedSlot, slot1); | 27 assert_equals(child2.assignedSlot, slot1); |
29 assert_equals(child3.assignedSlot, slot3); | 28 assert_equals(child3.assignedSlot, slot3); |
30 assert_equals(child4.assignedSlot, slot1); | 29 assert_equals(child4.assignedSlot, slot1); |
31 }, "assignedSlot"); | 30 }, "assignedSlot"); |
32 | 31 |
33 test(() => { | 32 test(() => { |
34 assert_array_equals(slot1.assignedNodes(), [child2, child4]); | 33 assert_array_equals(slot1.assignedNodes(), [child2, child4]); |
35 assert_array_equals(slot2.assignedNodes(), []); | 34 assert_array_equals(slot2.assignedNodes(), []); |
36 assert_array_equals(slot3.assignedNodes(), [child3]); | 35 assert_array_equals(slot3.assignedNodes(), [child3]); |
37 }, "assignedNodes"); | 36 }, "assignedNodes"); |
38 | 37 |
39 test(() => { | 38 test(() => { |
40 assert_array_equals(slot1.assignedNodes({flatten: true}), [child2, child4]); | 39 assert_array_equals(slot1.assignedNodes({flatten: true}), [child2, child4]); |
41 assert_array_equals(slot2.assignedNodes({flatten: true}), []); | 40 assert_array_equals(slot2.assignedNodes({flatten: true}), []); |
42 assert_array_equals(slot3.assignedNodes({flatten: true}), [child3]); | 41 assert_array_equals(slot3.assignedNodes({flatten: true}), [child3]); |
43 }, "getDistributedNodes"); | 42 }, "getDistributedNodes"); |
44 </script> | 43 </script> |
OLD | NEW |