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