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 <!-- This is a micro benchmark to catch an unintentional regression. |
| 6 If the reason of a regression is clear, it is okay. |
| 7 We do not have to optimize the result of the benchmark. --> |
| 8 <div id='d1'> |
| 9 <template data-mode='open' data-expose-as='d1_shadow'> |
| 10 <slot name='d1-s1'></slot> |
| 11 </template> |
| 12 <div id='d2' slot='d1-s1'></div> |
| 13 </div> |
| 14 <script> |
| 15 'use strict'; |
| 16 convertTemplatesToShadowRootsWithin(d1); |
| 17 removeWhiteSpaceOnlyTextNodes(d1); |
| 18 |
| 19 async_test((test) => { |
| 20 |
| 21 const d1_s1 = d1_shadow.querySelector('slot'); |
| 22 |
| 23 assert_array_equals(d1_s1.assignedNodes(), [d2]); |
| 24 assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2]); |
| 25 |
| 26 d1_s1.addEventListener('slotchange', (e) => { |
| 27 test.step(() => { |
| 28 assert_equals(e.target, d1_s1); |
| 29 assert_array_equals(d1_s1.assignedNodes(), []); |
| 30 assert_array_equals(d1_s1.assignedNodes({'flatten': true}), []); |
| 31 assert_equals(e.scoped, true); |
| 32 test.done(); |
| 33 }); |
| 34 }); |
| 35 |
| 36 d2.setAttribute('slot', 'non-exist'); |
| 37 }, "slotchange event caused by renaming slot name"); |
| 38 </script> |
OLD | NEW |