imperative-slot-api-crash.html (810B)
1 <!DOCTYPE html> 2 <link rel="author" href="mailto:masonf@chromium.org"> 3 <link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#dom-slot-assign"> 4 <link rel="help" href="https://crbug.com/1201402"> 5 6 <div id="host"> 7 <div id="child1"></div> 8 </div> 9 This test passes if it does not crash. 10 <script> 11 const host = document.querySelector("#host"); 12 const child1 = document.querySelector("#child1"); 13 const shadow_root = host.attachShadow({ mode: "open", slotAssignment: "manual" }); 14 var slot1 = document.createElement("slot"); 15 slot1.id = "first_slot"; 16 shadow_root.appendChild(slot1); 17 slot1.assign(child1); 18 slot1.remove(); 19 slot1 = document.createElement("slot"); 20 slot1.id = "second_slot"; 21 shadow_root.appendChild(slot1); 22 slot1.assign(child1); // Shouldn't crash here 23 </script>