assign-slottables-after-removing-shadow-tree-from-document.html (1425B)
1 <!DOCTYPE html> 2 <head> 3 <title>Slottables should match slots when the shadow host is removed from the document</title> 4 <meta name="author" title="Simon Wülker" href="mailto:simon.wuelker@arcor.de"> 5 <meta name="assert" content="Slottables should be assigned to slots even after the shadow host has been removed from the document"> 6 <link rel="help" href="https://github.com/servo/servo/issues/40242"> 7 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 </head> 11 12 <body> 13 <script defer> 14 test((t) => { 15 // Attach a shadow root with a slot named "foo" inside it 16 let host = document.createElement("div"); 17 document.body.appendChild(host); 18 let root = host.attachShadow({mode: "closed"}); 19 let slot = document.createElement("slot"); 20 slot.name = "foo"; 21 root.appendChild(slot); 22 23 // Remove the host from the document tree 24 host.remove(); 25 assert_array_equals(slot.assignedNodes(), []); 26 27 // Create a slottable that should be slotted into "foo" 28 let slottable = document.createElement("div"); 29 slottable.slot = "foo" 30 host.appendChild(slottable); 31 assert_array_equals(slot.assignedNodes(), [slottable]); 32 }, "Slottables should be assigned to slots even after the shadow host has been removed from the document"); 33 </script> 34 </body>