Index: third_party/WebKit/LayoutTests/custom-elements/v0-v1-interop.html |
diff --git a/third_party/WebKit/LayoutTests/custom-elements/v0-v1-interop.html b/third_party/WebKit/LayoutTests/custom-elements/v0-v1-interop.html |
index ce7e824e634fb6db013db3815b03329b4ef1cc07..19eaf29432e990849feeeec1d99efafbed46cecd 100644 |
--- a/third_party/WebKit/LayoutTests/custom-elements/v0-v1-interop.html |
+++ b/third_party/WebKit/LayoutTests/custom-elements/v0-v1-interop.html |
@@ -22,4 +22,33 @@ test_with_window((w) => { |
w.customElements.define('old-new', Y); |
}, '"defining" (v1) a name already "registered" (v0) should throw'); |
}, 'Overlapping old and new-style custom elements are not allowed'); |
+ |
+test_with_window((w) => { |
+ var A = w.document.registerElement('a-a', { |
+ prototype: Object.create(w.HTMLDivElement.prototype), |
+ extends: 'div' |
+ }); |
+ var a = w.document.createElement('div', 'a-a'); |
+ |
+ assert_true(a instanceof A, |
+ 'V0 createElement syntax works with V0 registerElement'); |
+ assert_throws_dom_exception(w, 'NotFoundError', () => { |
+ w.document.createElement('div', {is: 'a-a'}); |
+ }, 'V1 createElement syntax does not work with V0 registerElement'); |
+ |
+ class B extends w.HTMLDivElement { |
+ constructor() { |
+ super(); |
+ this.addEventListener("click", () => { |
+ console.log("CLICKED B!"); |
+ }); |
+ } |
+ } |
+ w.customElements.define('b-b', B, {extends: 'div' }); |
+ |
+ assert_true(w.document.createElement('div', {is: 'b-b'}) instanceof B, |
+ 'V1 createElement syntax works with V1 defined element'); |
+ assert_true(w.document.createElement('div', 'b-b') instanceof w.HTMLDivElement, |
+ 'V0 createElement syntax does not work with V1 defined element'); |
+}, 'V0 and V1 definition and createElement cannot be used together'); |
</script> |