| 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 /* |
| 12 Wrapper over <style> elements to co-operate with ShadyCSS |
| 13 |
| 14 Example: |
| 15 <custom-style> |
| 16 <style> |
| 17 ... |
| 18 </style> |
| 19 </custom-style> |
| 20 */ |
| 21 (function() { |
| 22 'use strict'; |
| 23 |
| 24 const CustomStyleInterface = window.ShadyCSS.CustomStyleInterface; |
| 25 |
| 26 class CustomStyle extends HTMLElement { |
| 27 constructor() { |
| 28 super(); |
| 29 this._style = null; |
| 30 CustomStyleInterface.addCustomStyle(this); |
| 31 } |
| 32 getStyle() { |
| 33 if (!this._style) { |
| 34 this._style = this.querySelector('style'); |
| 35 } |
| 36 return this._style; |
| 37 } |
| 38 } |
| 39 |
| 40 window.CustomStyle = CustomStyle; |
| 41 window.customElements.define('custom-style', CustomStyle); |
| 42 })(); |
| OLD | NEW |