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> |