Skip to content

Instantly share code, notes, and snippets.

@raggi

raggi/index.html Secret

Last active April 11, 2016 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raggi/df9d8170164c6a29bc4a to your computer and use it in GitHub Desktop.
Save raggi/df9d8170164c6a29bc4a to your computer and use it in GitHub Desktop.
<!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