Last active
February 28, 2016 00:36
-
-
Save pomber/54fdfa78c70e54a1deb4 to your computer and use it in GitHub Desktop.
From Zero to Polymer: Step 01 - document.registerElement
This file contains hidden or 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> | |
<html lang="en"> | |
<body> | |
<my-element></my-element> | |
<my-element></my-element> | |
<script> | |
var MyElementProto = Object.create(HTMLElement.prototype); | |
MyElementProto.createdCallback = function() { | |
this.innerHTML = "<p>My <b>custom element</b> markup!</p>"; | |
}; | |
var MyElement = document.registerElement( | |
'my-element', { prototype: MyElementProto } | |
); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment