custom-element-template
Template skeleton Custom Elements
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.7.22/webcomponents-lite.min.js"></script>
<element name="say-hello">
<template>
Hello <content></content>!
</template>
<script>
if (this !== window) {
var template = this.querySelector('template');
this.register({
prototype: {
readyCallback: function() {
var clone = template.content.cloneNode(true);
this.webkitCreateShadowRoot().appendChild(clone);
}
}
});
}
</script>
</element>
<say-hello>Eric</say-hello>