Last active
April 25, 2017 15:15
-
-
Save riodw/4fd7595d6b775752193497908ca16021 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
<!-- Rio Weber | |
Create Custom HTML Element --> | |
<html> | |
<head> | |
<title>Make Custom HTML Element</title> | |
</head> | |
<body> | |
<hello-element></hello-element> | |
<script> | |
var proto = Object.create(HTMLElement.prototype); | |
proto.createdCallback = function() { | |
this.textContent = 'Hello World!'; | |
} | |
proto.addMoreText = function(s) { | |
this.textContent = this.textContent + s; | |
} | |
document.registerElement('hello-element', { | |
prototype: proto | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment