OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <script src='../../../resources/testharness.js'></script> |
| 4 <script src='../../../resources/testharnessreport.js'></script> |
| 5 <script src='resources/shadow-dom.js'></script> |
| 6 <div id='d1'> |
| 7 <template data-mode='open'> |
| 8 <div id='d1-1'> |
| 9 <template data-mode='open'> |
| 10 <div id='d1-1-1'></div> |
| 11 <slot name='d1-1-s1'></slot> |
| 12 <slot name='d1-1-s2'></slot> |
| 13 <div id='d1-1-2'></div> |
| 14 </template> |
| 15 <div id='d1-2'></div> |
| 16 <slot id='d1-s0'></slot> |
| 17 <slot name='d1-s1' slot='d1-1-s1'></slot> |
| 18 <slot name='d1-s2'></slot> |
| 19 <div id='d1-3'></div> |
| 20 <div id='d1-4' slot='d1-1-s1'></div> |
| 21 </div> |
| 22 </template> |
| 23 <div id='d2' slot='d1-s1'></div> |
| 24 <div id='d3' slot='d1-s2'></div> |
| 25 <div id='d4' slot='non-existent'></div> |
| 26 <div id='d5'></div> |
| 27 </div> |
| 28 <script> |
| 29 'use strict'; |
| 30 convertTemplatesToShadowRootsWithin(d1); |
| 31 removeWhiteSpaceOnlyTextNodes(d1); |
| 32 document.body.offsetLeft; |
| 33 |
| 34 const d1_shadow = d1.shadowRoot; |
| 35 const d1_1 = d1_shadow.querySelector('#d1-1'); |
| 36 const d1_2 = d1_shadow.querySelector('#d1-2'); |
| 37 const d1_3 = d1_shadow.querySelector('#d1-3'); |
| 38 const d1_4 = d1_shadow.querySelector('#d1-4'); |
| 39 const d1_s0= d1_shadow.querySelector('#d1-s0'); |
| 40 const d1_s1 = d1_shadow.querySelector('[name=d1-s1]'); |
| 41 const d1_s2 = d1_shadow.querySelector('[name=d1-s2]'); |
| 42 |
| 43 const d1_1_shadow = d1_1.shadowRoot; |
| 44 const d1_1_1 = d1_1_shadow.querySelector('#d1-1-1'); |
| 45 const d1_1_2 = d1_1_shadow.querySelector('#d1-1-2'); |
| 46 const d1_1_s1 = d1_1_shadow.querySelector('[name=d1-1-s1]'); |
| 47 const d1_1_s2 = d1_1_shadow.querySelector('[name=d1-1-s2]'); |
| 48 |
| 49 test(() => { |
| 50 assert_equals(d1.assignedSlot, null); |
| 51 assert_equals(d2.assignedSlot, d1_s1); |
| 52 assert_equals(d3.assignedSlot, d1_s2); |
| 53 assert_equals(d4.assignedSlot, null); |
| 54 assert_equals(d5.assignedSlot, d1_s0); |
| 55 |
| 56 assert_equals(d1_2.assignedSlot, null); |
| 57 assert_equals(d1_s0.assignedSlot, null); |
| 58 assert_equals(d1_s1.assignedSlot, d1_1_s1); |
| 59 assert_equals(d1_s2.assignedSlot, null); |
| 60 assert_equals(d1_3.assignedSlot, null); |
| 61 assert_equals(d1_4.assignedSlot, d1_1_s1); |
| 62 }, "assignedSlot"); |
| 63 |
| 64 test(() => { |
| 65 assert_array_equals(d1_s0.getAssignedNodes(), [d5]); |
| 66 assert_array_equals(d1_s1.getAssignedNodes(), [d2]); |
| 67 assert_array_equals(d1_s2.getAssignedNodes(), [d3]); |
| 68 |
| 69 assert_array_equals(d1_1_s1.getAssignedNodes(), [d1_s1, d1_4]); |
| 70 assert_array_equals(d1_1_s2.getAssignedNodes(), []); |
| 71 }, "getAssignedNodes"); |
| 72 |
| 73 test(() => { |
| 74 assert_array_equals(d1_s0.getDistributedNodes(), [d5]); |
| 75 assert_array_equals(d1_s1.getDistributedNodes(), [d2]); |
| 76 assert_array_equals(d1_s2.getDistributedNodes(), [d3]); |
| 77 |
| 78 assert_array_equals(d1_1_s1.getDistributedNodes(), [d2, d1_4]); |
| 79 assert_array_equals(d1_1_s2.getDistributedNodes(), []); |
| 80 }, "getDistributedNodes"); |
| 81 </script> |
OLD | NEW |