From a247b5500866a602c102e106887abdc9ab4a1561 Mon Sep 17 00:00:00 2001 From: Chris Joel Date: Wed, 24 Aug 2016 16:17:50 -0700 Subject: [PATCH 1/4] now works with Custom Elements v1 --- bower.json | 3 +- test-fixture.html | 17 ++- test/index.html | 1 + test/test-fixture-v1.html | 256 ++++++++++++++++++++++++++++++++++++++ test/test-fixture.html | 2 +- 5 files changed, 274 insertions(+), 5 deletions(-) create mode 100644 test/test-fixture-v1.html diff --git a/bower.json b/bower.json index 1605eff..570a5c3 100644 --- a/bower.json +++ b/bower.json @@ -10,7 +10,8 @@ ], "devDependencies": { "web-component-tester": "^4.0.0", - "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" + "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0", + "webcomponentsjs-v1": "webcomponents/webcomponentsjs#v1-polymer-edits" }, "main": "test-fixture.html", "ignore": [] diff --git a/test-fixture.html b/test-fixture.html index bafd4b3..477e109 100644 --- a/test-fixture.html +++ b/test-fixture.html @@ -313,9 +313,20 @@ }); try { - document.registerElement('test-fixture', { - prototype: TestFixturePrototype - }); + if (window.customElements) { + function TestFixture() { + return ((window.Reflect && Reflect.construct) ? + Reflect.construct(HTMLElement, [], TestFixture) + : HTMLElement.call(this)) || this; + } + TestFixture.prototype = TestFixturePrototype; + TestFixture.prototype.constructor = TestFixture; + customElements.define('test-fixture', TestFixture); + } else { + document.registerElement('test-fixture', { + prototype: TestFixturePrototype + }); + } } catch (e) { if (window.WCT) { console.warn('if you are using WCT, you do not need to manually import test-fixture.html'); diff --git a/test/index.html b/test/index.html index a00d9a2..f855217 100644 --- a/test/index.html +++ b/test/index.html @@ -22,6 +22,7 @@ diff --git a/test/test-fixture-v1.html b/test/test-fixture-v1.html new file mode 100644 index 0000000..d866ebb --- /dev/null +++ b/test/test-fixture-v1.html @@ -0,0 +1,256 @@ + + + + + test-fixture + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/test-fixture.html b/test/test-fixture.html index 00788c8..197bb91 100644 --- a/test/test-fixture.html +++ b/test/test-fixture.html @@ -14,9 +14,9 @@ - + - - diff --git a/test/test-fixture-v1.html b/test/test-fixture-v1.html index d866ebb..b97e199 100644 --- a/test/test-fixture-v1.html +++ b/test/test-fixture-v1.html @@ -21,6 +21,10 @@ + @@ -21,10 +27,6 @@