-
-
Save raggi/df9d8170164c6a29bc4a to your computer and use it in GitHub Desktop.
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
<!doctype html> | |
<title>minimal replication</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.7.21/webcomponents-lite.js"></script> | |
<body> | |
<pre id=s>running...</pre> | |
<script defer> | |
var XForm = document.registerElement('x-form', { | |
prototype: Object.create(HTMLFormElement.prototype, { | |
submit: { value: function() { console.log('pass') } } | |
}), | |
extends: "form" | |
}); | |
form = document.createElement('form', 'x-form'); | |
input = document.createElement('input') | |
input.name = "submit"; | |
form.appendChild(input); | |
// Under chrome (stable and canary) this gets the input element, instead of | |
// the function from the custom element prototype. | |
if (form.submit instanceof HTMLElement) { | |
s.innerHTML = "fail"; | |
} else { | |
s.innerHTML = "pass"; | |
} | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment