OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Custom Elements: Remove an element</title> |
| 3 <link rel="help" href="https://dom.spec.whatwg.org/#concept-node-remove"> |
| 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="resources/custom-elements-helpers.js"></script> |
| 7 <body> |
| 8 <script> |
| 9 'use strict'; |
| 10 |
| 11 // 15. For each shadow-including descendant descendant of node, in shadow-includ
ing tree order, |
| 12 // run these substeps: |
| 13 // 2. If descendant is custom, then enqueue a custom element callback reaction
with descendant, |
| 14 // callback name "disconnectedCallback", and an empty argument list. |
| 15 test_with_window((w) => { |
| 16 w.document.body.innerHTML = ` |
| 17 <a-a id="a"> |
| 18 <p> |
| 19 <a-a id="b"></a-a> |
| 20 <a-a id="c"></a-a> |
| 21 </p> |
| 22 <a-a id="d"></a-a> |
| 23 </a-a>`; |
| 24 let invocations = []; |
| 25 class X extends w.HTMLElement { |
| 26 disconnectedCallback() { invocations.push(this); } |
| 27 } |
| 28 w.customElements.define('a-a', X); |
| 29 w.document.getElementById("a").remove(); |
| 30 assert_array_equals(['a', 'b', 'c', 'd'], invocations.map((e) => e.id), |
| 31 'four elements should have been removed in doc order'); |
| 32 },'Remove an element'); |
| 33 </script> |
| 34 </body> |
OLD | NEW |