Last active
August 23, 2016 16:38
-
-
Save thomaswilburn/2accfecb76bb304e6802c65d1567b568 to your computer and use it in GitHub Desktop.
document-register-element v1 shim test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var F = function(self) { | |
//being called from the shim | |
if (self) { | |
HTMLElement.call(self); | |
return self; | |
} | |
//must be native, use Reflect.construct() to perform super() | |
//this code is untested, came from rniwa | |
return Reflect.construct(HTMLElement, [], F); | |
}; | |
F.prototype = Object.create(HTMLElement.prototype); | |
F.prototype.constructor = HTMLElement; | |
F.prototype.testMethod = function() { | |
console.log("hello world"); | |
} | |
console.log(F); | |
//this works fine | |
customElements.define("st-tag", F); | |
//this currently crashes in Chrome Beta | |
//I don't think HTMLElement itself is being patched correctly | |
var el = document.createElement("st-tag"); | |
el.testMethod(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment