OLD | NEW |
---|---|
(Empty) | |
1 <div id="sandbox"></div> | |
2 <script> | |
3 test(() => { | |
4 assert_equals(constructors.length, 0); | |
5 | |
6 class CreateElement extends HTMLElement { | |
dominicc (has gone to gerrit)
2016/08/19 04:54:11
Give this a different name; calling it CreateEleme
kochi
2016/08/19 10:51:48
Done.
| |
7 constructor() { | |
8 super(); | |
9 constructors.push('constructor'); | |
10 } | |
11 } | |
12 | |
13 customElements.define('create-element', CreateElement); | |
dominicc (has gone to gerrit)
2016/08/19 04:54:11
We've generally used a-a for a succinct custom ele
kochi
2016/08/19 10:51:48
Done.
| |
14 | |
15 let importDoc = document.currentScript.ownerDocument; | |
16 let sandbox = importDoc.querySelector('#sandbox'); | |
17 | |
18 // createElement should synchronously customize. | |
dominicc (has gone to gerrit)
2016/08/19 04:54:11
Maybe delete the blank line between createElement
kochi
2016/08/19 10:51:48
Done.
| |
19 let el = document.createElement('create-element'); | |
20 | |
21 assert_equals(constructors.length, 1); | |
22 | |
23 let el2 = new CreateElement(); | |
24 | |
25 sandbox.appendChild(el); | |
26 sandbox.appendChild(el2); | |
27 | |
28 // TODO: test something | |
dominicc (has gone to gerrit)
2016/08/19 04:54:11
Be more specific: TODO(who): what when
kochi
2016/08/19 10:51:48
Yeah, this test was very work in progress...
This
| |
29 | |
30 }, 'createElement() should work in imported document.'); | |
dominicc (has gone to gerrit)
2016/08/19 04:54:11
Add assertions for importDoc.createElement. What s
kochi
2016/08/19 10:51:48
Done.
| |
31 </script> | |
OLD | NEW |