| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 @license |
| 3 Copyright (c) 2016 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> |
| 10 |
| 11 <script> |
| 12 // Kick off shady CSS. |
| 13 var template = document.createElement('template'); |
| 14 template.innerHTML = |
| 15 ` |
| 16 <style>:host {color: blue;} .red-text {color: red;} </style> |
| 17 <p class="red-text">Shadow DOM</p> |
| 18 <slot id="slot"></slot> |
| 19 `; |
| 20 if (template) { |
| 21 if (window.ShadyCSS) { |
| 22 window.ShadyCSS.prepareTemplate(template, 'simple-element'); |
| 23 } |
| 24 } |
| 25 |
| 26 class SimpleElement extends HTMLElement { |
| 27 constructor() { |
| 28 super(); |
| 29 this.bestName = 'batman'; |
| 30 if (window.ShadyCSS) { |
| 31 window.ShadyCSS.styleElement(this); |
| 32 } |
| 33 |
| 34 if (template && !this.shadowRoot) { |
| 35 this.attachShadow({mode: 'open'}); |
| 36 this.shadowRoot.appendChild(document.importNode(template.content, true))
; |
| 37 } |
| 38 } |
| 39 } |
| 40 |
| 41 window.customElements.define('simple-element', SimpleElement); |
| 42 </script> |
| OLD | NEW |