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

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/v0-v1-interop.html

Issue 2477713003: Custom Elements: Check Definition in createElement, Create Customized Built-in Elements Sync (Closed)
Patch Set: patch fix Created 4 years, 1 month 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/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>

Powered by Google App Engine
This is Rietveld 408576698