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 | |
10 'use strict' | |
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 test_with_window((w) => { | |
15 let invocations = []; | |
16 let doc = w.document; | |
17 let a = doc.createElement('a-a'); | |
18 doc.body.appendChild(a); | |
19 class X extends w.HTMLElement { | |
20 constructor() {} | |
21 adoptedCallback() { invocations.push(['adopted', this, arguments]); } | |
22 } | |
23 w.customElements.define('a-a', X); | |
24 doc.adoptNode(a); | |
25 assert_equals(invocations.length, 1); | |
dominicc (has gone to gerrit)
2016/07/22 09:07:58
We're writing a lot of things which push records i
| |
26 assert_array_equals(invocations[0].slice(0,2), ['adopted', a], 'the adoptedCal lback should be invoked'); | |
dominicc (has gone to gerrit)
2016/07/22 09:07:58
space after ,
| |
27 assert_array_equals(invocations[0][0], [], 'the adoptedCallback should be invo ked with empty argumnets'); | |
dominicc (has gone to gerrit)
2016/07/22 09:07:58
spelling: arguments
| |
28 }, 'adopting a custom element to the same document should enqueue an adoptedCall back reaction'); | |
29 </script> | |
30 </body> | |
OLD | NEW |