Created
February 3, 2016 14:29
-
-
Save AndyNovo/0a32b575de68582dc7ff to your computer and use it in GitHub Desktop.
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> | |
| <head> | |
| <script src="http://polygit.org/components/webcomponentsjs/webcomponents-lite.js"></script> | |
| <link rel="import" href="ninja.html"> | |
| </head> | |
| <body> | |
| <ninja-killa></ninja-killa> | |
| <ninja-killa></ninja-killa> | |
| <ninja-killa></ninja-killa> | |
| <ninja-killa></ninja-killa> | |
| <p>This is a boring old paragraph</p> | |
| </body> | |
| </html> |
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
| <template> | |
| <style> * { color: salmon; } </style> | |
| <div class="ninja"> | |
| This is a ninja. It is amazing. | |
| </div> | |
| </template> | |
| <script> | |
| var template = document.currentScript.ownerDocument.getElementsByTagName('template')[0]; | |
| var $baseElement = Object.create(HTMLElement.prototype); | |
| $baseElement.createdCallback = function(){ | |
| var shadow = this.createShadowRoot(); | |
| var clone = document.importNode(template.content, true); | |
| shadow.appendChild(clone); | |
| }; | |
| document.registerElement('ninja-killa', { | |
| prototype: $baseElement | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment