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='d1'> |
| 6 <template data-mode='closed' data-expose-as='d1_shadow'> |
| 7 <div id='d1-1'> |
| 8 <template data-mode='open'> |
| 9 <slot name='d1-1-s1'></slot> |
| 10 </template> |
| 11 <div id='d1-2' slot='d1-1-s1'></div> |
| 12 <slot name='d1-s1' slot='d1-1-s1'></slot> |
| 13 <slot name='d1-s2'></slot> |
| 14 </div> |
| 15 </template> |
| 16 <div id='d2' slot='d1-s1'></div> |
| 17 <div id='d3' slot='d1-s2'></div> |
| 18 </div> |
| 19 <script> |
| 20 'use strict'; |
| 21 convertTemplatesToShadowRootsWithin(d1); |
| 22 removeWhiteSpaceOnlyTextNodes(d1); |
| 23 document.body.offsetLeft; |
| 24 |
| 25 const d1_1 = d1_shadow.querySelector('#d1-1'); |
| 26 const d1_2 = d1_shadow.querySelector('#d1-2'); |
| 27 const d1_s1 = d1_shadow.querySelector('[name=d1-s1]'); |
| 28 const d1_s2 = d1_shadow.querySelector('[name=d1-s2]'); |
| 29 |
| 30 const d1_1_shadow = d1_1.shadowRoot; |
| 31 const d1_1_s1 = d1_1_shadow.querySelector('[name=d1-1-s1]'); |
| 32 |
| 33 test(() => { |
| 34 assert_equals(d1.assignedSlot, null); |
| 35 assert_equals(d2.assignedSlot, null); |
| 36 assert_equals(d3.assignedSlot, null); |
| 37 }, "A slot in a closed shadow tree should not be accessed via assignedSlot"); |
| 38 |
| 39 test(() => { |
| 40 assert_equals(d1_2.assignedSlot, d1_1_s1); |
| 41 assert_equals(d1_s1.assignedSlot, d1_1_s1); |
| 42 assert_equals(d1_s2.assignedSlot, null); |
| 43 }, "A slot in a open shadow tree should be accessed via assignedSlot from a clos
ed shadow tree"); |
| 44 |
| 45 test(() => { |
| 46 assert_array_equals(d1_s1.getAssignedNodes(), [d2]); |
| 47 assert_array_equals(d1_s2.getAssignedNodes(), [d3]); |
| 48 assert_array_equals(d1_1_s1.getAssignedNodes(), [d1_2, d1_s1]); |
| 49 }, "A closed shadow tree has nothing to do with the behavior of getAssignedNodes
"); |
| 50 |
| 51 test(() => { |
| 52 assert_array_equals(d1_s1.getDistributedNodes(), [d2]); |
| 53 assert_array_equals(d1_s2.getDistributedNodes(), [d3]); |
| 54 assert_array_equals(d1_1_s1.getDistributedNodes(), [d1_2, d2]); |
| 55 }, "A closed shadow tree has nothing to do with the behavior of getDistributedNo
des"); |
| 56 </script> |
OLD | NEW |