Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: third_party/WebKit/LayoutTests/custom-elements/imports/resources/create-element.html

Issue 2242743002: Make custom elements work in HTML imports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses tkent's comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <script>
2 'use strict';
3
4 let constructors = [];
5
6 test(() => {
7 assert_equals(constructors.length, 0);
8
9 class MyElement extends HTMLElement {
10 constructor() {
11 super();
12 constructors.push(this);
13 }
14 }
15
16 customElements.define('a-a', MyElement);
17
18 // createElement should synchronously call constructor.
19 let a = document.createElement('a-a');
20 assert_equals(constructors.length, 1);
21 assert_equals(a.ownerDocument, document);
22
23 let importDoc = document.currentScript.ownerDocument;
24
25 // TODO(kochi): crbug.com/640465 createElement returns wrong ownerDocument
26 // createElement should work in imported document.
27 let b = importDoc.createElement('a-a')
28 assert_equals(b.ownerDocument, importDoc);
29 assert_equals(constructors.length, 2);
30
31 // new MyElement() should synchronously call constructor.
32 let c = new MyElement();
33 assert_equals(c.ownerDocument, document);
34 assert_equals(constructors.length, e);
35
36 assert_array_equals(constructors, [a, b, c]);
37 }, 'createElement() and new MyElement should work in imported document.');
38 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698