Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <template> | |
| 3 <style> | |
| 4 @import url(hello.css); | |
| 5 </style> | |
| 6 <h1>Hello</h1> | |
| 7 </template> | |
| 8 <script> | |
| 9 var t = document.currentScript.ownerDocument.querySelector('template'); | |
| 10 var proto = Object.create(HTMLElement.prototype); | |
| 11 proto.createdCallback = function() { | |
| 12 var root = this.createShadowRoot(); | |
| 13 root.appendChild(document.importNode(t.content)); | |
| 14 }; | |
| 15 document.registerElement('x-test', {prototype: proto}); | |
| 16 </script> | |
| OLD | NEW |