| 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='d1'> | 5 <div id='d1'> |
| 6 <template data-mode='open' data-expose-as='d1_shadow'> | 6 <template data-mode='open' data-expose-as='d1_shadow'> |
| 7 <slot name='d1-s1'></slot> | 7 <slot name='d1-s1'></slot> |
| 8 </template> | 8 </template> |
| 9 <div id='d2' slot='d1-s1'></div> | 9 <div id='d2' slot='d1-s1'></div> |
| 10 </div> | 10 </div> |
| 11 <script> | 11 <script> |
| 12 'use strict'; | 12 'use strict'; |
| 13 convertTemplatesToShadowRootsWithin(d1); | 13 convertTemplatesToShadowRootsWithin(d1); |
| 14 removeWhiteSpaceOnlyTextNodes(d1); | 14 removeWhiteSpaceOnlyTextNodes(d1); |
| 15 | 15 |
| 16 async_test((test) => { | 16 async_test((test) => { |
| 17 | 17 |
| 18 const d1_s1 = d1_shadow.querySelector('slot'); | 18 const d1_s1 = d1_shadow.querySelector('slot'); |
| 19 | 19 |
| 20 assert_array_equals(d1_s1.assignedNodes(), [d2]); | 20 assert_array_equals(d1_s1.assignedNodes(), [d2]); |
| 21 assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2]); | 21 assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2]); |
| 22 | 22 |
| 23 d1_s1.addEventListener('slotchange', (e) => { | 23 d1_s1.addEventListener('slotchange', (e) => { |
| 24 test.step(() => { | 24 test.step(() => { |
| 25 assert_equals(e.target, d1_s1); | 25 assert_equals(e.target, d1_s1); |
| 26 assert_array_equals(d1_s1.assignedNodes(), [d2, d3]); | 26 assert_array_equals(d1_s1.assignedNodes(), [d2, d3]); |
| 27 assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2, d3]); | 27 assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2, d3]); |
| 28 assert_equals(e.scoped, true); | |
| 29 test.done(); | 28 test.done(); |
| 30 }); | 29 }); |
| 31 }); | 30 }); |
| 32 | 31 |
| 33 const d3 = document.createElement('div'); | 32 const d3 = document.createElement('div'); |
| 34 d3.setAttribute('id', 'd3'); | 33 d3.setAttribute('id', 'd3'); |
| 35 d3.setAttribute('slot', 'd1-s1'); | 34 d3.setAttribute('slot', 'd1-s1'); |
| 36 d1.appendChild(d3); | 35 d1.appendChild(d3); |
| 37 }, "slotchange event caused by appending a host child"); | 36 }, "slotchange event caused by appending a host child"); |
| 38 </script> | 37 </script> |
| OLD | NEW |