Chromium Code Reviews| 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 | |
|
dominicc (has gone to gerrit)
2016/07/25 07:56:14
Delete this blank line. You could separate use str
| |
| 10 'use strict' | |
| 11 // 3. If document is not the same as the oldDocument: | |
|
dominicc (has gone to gerrit)
2016/07/25 07:56:14
Could we add tests for what happens to exceptions
| |
| 12 // 3.2 For each inclusiveDescendant in node’s shadow-including inclusive desce ndants that is | |
| 13 // a custom element, enqueue a custom element callback reaction with inclusive Descendant, | |
| 14 // callback name "adoptedCallback", and an empty argument list. | |
| 15 test_with_window((w) => { | |
| 16 let invocations = []; | |
| 17 let doc = w.document; | |
| 18 let frame = doc.createElement('iframe'); | |
|
dominicc (has gone to gerrit)
2016/07/25 07:56:13
Look at how test_with_window is implemented and do
| |
| 19 doc.body.appendChild(frame); | |
| 20 let iframeWindow = frame.contentWindow; | |
| 21 let iframeDoc = iframeWindow.document; | |
| 22 let a = iframeDoc.createElement('a-a'); | |
| 23 iframeDoc.body.appendChild(a); | |
| 24 class X extends iframeWindow.HTMLElement { | |
|
dominicc (has gone to gerrit)
2016/07/25 07:56:13
Be consistent with naming; w is an iframe window t
| |
| 25 constructor() { super(); } | |
|
dominicc (has gone to gerrit)
2016/07/25 07:56:13
Again--the implicit one is all you need; you can o
davaajav
2016/08/02 07:21:20
Omitting super(); was resulting in "this" being un
| |
| 26 adoptedCallback() { invocations.push(['adopted', this, arguments]); } | |
| 27 } | |
| 28 iframeWindow.customElements.define('a-a', X); | |
| 29 doc.adoptNode(a); | |
| 30 let expected_invocations = [ ['adopted', a, []] ]; | |
| 31 assert_array_equals_callback_invocations(invocations, expected_invocations); | |
| 32 }, 'adopting a custom element to the same document should enqueue an adoptedCall back reaction'); | |
|
dominicc (has gone to gerrit)
2016/07/25 07:56:14
It might be worth adding a test that adopting or m
| |
| 33 </script> | |
| 34 </body> | |
| OLD | NEW |