| OLD | NEW |
| (Empty) | |
| 1 /** |
| 2 @license |
| 3 Copyright (c) 2017 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 'use strict'; |
| 12 |
| 13 import ScopingShim from '../src/scoping-shim.js' |
| 14 import {nativeCssVariables, nativeShadow} from '../src/style-settings.js' |
| 15 |
| 16 /** @const {ScopingShim} */ |
| 17 const scopingShim = new ScopingShim(); |
| 18 |
| 19 let ApplyShim, CustomStyleInterface; |
| 20 |
| 21 if (window['ShadyCSS']) { |
| 22 ApplyShim = window['ShadyCSS']['ApplyShim']; |
| 23 CustomStyleInterface = window['ShadyCSS']['CustomStyleInterface']; |
| 24 } |
| 25 |
| 26 window.ShadyCSS = { |
| 27 ScopingShim: scopingShim, |
| 28 /** |
| 29 * @param {!HTMLTemplateElement} template |
| 30 * @param {string} elementName |
| 31 * @param {string=} elementExtends |
| 32 */ |
| 33 prepareTemplate(template, elementName, elementExtends) { |
| 34 scopingShim.flushCustomStyles(); |
| 35 scopingShim.prepareTemplate(template, elementName, elementExtends) |
| 36 }, |
| 37 |
| 38 /** |
| 39 * @param {!HTMLElement} element |
| 40 * @param {Object=} properties |
| 41 */ |
| 42 styleSubtree(element, properties) { |
| 43 scopingShim.flushCustomStyles(); |
| 44 scopingShim.styleSubtree(element, properties); |
| 45 }, |
| 46 |
| 47 /** |
| 48 * @param {!HTMLElement} element |
| 49 */ |
| 50 styleElement(element) { |
| 51 scopingShim.flushCustomStyles(); |
| 52 scopingShim.styleElement(element); |
| 53 }, |
| 54 |
| 55 /** |
| 56 * @param {Object=} properties |
| 57 */ |
| 58 styleDocument(properties) { |
| 59 scopingShim.flushCustomStyles(); |
| 60 scopingShim.styleDocument(properties); |
| 61 }, |
| 62 |
| 63 /** |
| 64 * @param {Element} element |
| 65 * @param {string} property |
| 66 * @return {string} |
| 67 */ |
| 68 getComputedStyleValue(element, property) { |
| 69 return scopingShim.getComputedStyleValue(element, property); |
| 70 }, |
| 71 |
| 72 nativeCss: nativeCssVariables, |
| 73 |
| 74 nativeShadow: nativeShadow |
| 75 }; |
| 76 |
| 77 if (ApplyShim) { |
| 78 window.ShadyCSS.ApplyShim = ApplyShim; |
| 79 } |
| 80 |
| 81 if (CustomStyleInterface) { |
| 82 window.ShadyCSS.CustomStyleInterface = CustomStyleInterface; |
| 83 } |
| OLD | NEW |