| 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 <div id='shadow-child1'></div> | |
| 8 <slot></slot> | |
| 9 <slot name='slot1'></slot> | |
| 10 <div id='shadow-child2'></div> | |
| 11 </template> | |
| 12 <div id='child1' slot='slot1'></div> | |
| 13 Hello | |
| 14 <div id='child2'></div> | |
| 15 World | |
| 16 <div id='child3' slot='nonexistent'></div> | |
| 17 <!-- comment node --> | |
| 18 </div> | |
| 19 <script> | |
| 20 'use strict'; | |
| 21 convertTemplatesToShadowRootsWithin(host); | |
| 22 removeWhiteSpaceOnlyTextNodes(host); | |
| 23 document.body.offsetLeft; | |
| 24 | |
| 25 const slot1 = host.shadowRoot.querySelector('slot[name=slot1]'); | |
| 26 const defaultSlot = host.shadowRoot.querySelector('slot'); | |
| 27 const shadowChild1 = host.shadowRoot.querySelector('#shadow-child1'); | |
| 28 const shadowChild2 = host.shadowRoot.querySelector('#shadow-child2'); | |
| 29 | |
| 30 const textHello = host.childNodes[1]; | |
| 31 const textWorld = host.childNodes[3]; | |
| 32 const commentNode = child3.nextSibling; | |
| 33 | |
| 34 test(() => { | |
| 35 assert_equals(textHello.nodeValue.trim(), 'Hello'); | |
| 36 assert_equals(textWorld.nodeValue.trim(), 'World'); | |
| 37 assert_equals(commentNode.nodeType, Node.COMMENT_NODE); | |
| 38 | |
| 39 assert_equals(textHello.assignedSlot, defaultSlot); | |
| 40 assert_equals(textWorld.assignedSlot, defaultSlot); | |
| 41 assert_equals(commentNode.assignedSlot, undefined, "Comment Node does not defi
ne assignedSlot"); | |
| 42 assert_equals(child1.assignedSlot, slot1); | |
| 43 assert_equals(child2.assignedSlot, defaultSlot); | |
| 44 assert_equals(child3.assignedSlot, null); | |
| 45 }, "assignedSlot"); | |
| 46 | |
| 47 test(() => { | |
| 48 assert_array_equals(defaultSlot.getAssignedNodes({flatten: true}), [textHello,
child2, textWorld]); | |
| 49 assert_array_equals(slot1.getAssignedNodes({flatten: true}), [child1]); | |
| 50 }, "getAssignedNodes"); | |
| 51 | |
| 52 add_completion_callback(() => { | |
| 53 if (window.testRunner) | |
| 54 host.style.display = "none"; | |
| 55 }); | |
| 56 </script> | |
| OLD | NEW |