OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Custom Elements: adopt node</title> |
| 3 <link rel="help" href="https://dom.spec.whatwg.org/#concept-node-adopt"> |
| 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 // 3.2 For each inclusiveDescendant in node’s shadow-including inclusive descend
ants that is a custom |
| 12 // element, enqueue a custom element callback reaction with inclusiveDescendant, |
| 13 // callback name "adoptedCallback", and an empty argument list. |
| 14 promise_test((t) => { |
| 15 return Promise.all([ |
| 16 create_window_in_test(t), |
| 17 create_window_in_test(t)]) |
| 18 .then(([w1, w2]) => { |
| 19 let invocations = []; |
| 20 class X extends w1.HTMLElement { |
| 21 adoptedCallback() { invocations.push(['adopted', this, []]); } |
| 22 } |
| 23 w1.customElements.define('a-a', X); |
| 24 let a = w1.document.createElement('a-a'); |
| 25 w2.document.adoptNode(a); |
| 26 assert_array_equals_callback_invocations(invocations, [ ['adopted', a, []]
]); |
| 27 }); |
| 28 }, 'adopting a custom element to the different document should enqueue an adopte
dCallback reaction'); |
| 29 </script> |
| 30 </body> |
OLD | NEW |