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

Unified 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: rebase wip Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/custom-elements/imports/resources/create-element.html
diff --git a/third_party/WebKit/LayoutTests/custom-elements/imports/resources/create-element.html b/third_party/WebKit/LayoutTests/custom-elements/imports/resources/create-element.html
new file mode 100644
index 0000000000000000000000000000000000000000..dc2d1e555b550c76769b95c7426e2edfeb01e073
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/custom-elements/imports/resources/create-element.html
@@ -0,0 +1,31 @@
+<div id="sandbox"></div>
+<script>
+test(() => {
+ assert_equals(constructors.length, 0);
+
+ 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.
+ constructor() {
+ super();
+ constructors.push('constructor');
+ }
+ }
+
+ 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.
+
+ let importDoc = document.currentScript.ownerDocument;
+ let sandbox = importDoc.querySelector('#sandbox');
+
+ // 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.
+ let el = document.createElement('create-element');
+
+ assert_equals(constructors.length, 1);
+
+ let el2 = new CreateElement();
+
+ sandbox.appendChild(el);
+ sandbox.appendChild(el2);
+
+ // 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
+
+}, '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.
+</script>

Powered by Google App Engine
This is Rietveld 408576698