| 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 {StyleNode} from './css-parse.js' // eslint-disable-line no-unused-vars |
| 14 |
| 15 /** @const {string} */ |
| 16 const infoKey = '__styleInfo'; |
| 17 |
| 18 export default class StyleInfo { |
| 19 /** |
| 20 * @param {Element} node |
| 21 * @return {StyleInfo} |
| 22 */ |
| 23 static get(node) { |
| 24 if (node) { |
| 25 return node[infoKey]; |
| 26 } else { |
| 27 return null; |
| 28 } |
| 29 } |
| 30 /** |
| 31 * @param {!Element} node |
| 32 * @param {StyleInfo} styleInfo |
| 33 * @return {StyleInfo} |
| 34 */ |
| 35 static set(node, styleInfo) { |
| 36 node[infoKey] = styleInfo; |
| 37 return styleInfo; |
| 38 } |
| 39 /** |
| 40 * @param {StyleNode} ast |
| 41 * @param {Node=} placeholder |
| 42 * @param {Array<string>=} ownStylePropertyNames |
| 43 * @param {string=} elementName |
| 44 * @param {string=} typeExtension |
| 45 * @param {string=} cssBuild |
| 46 */ |
| 47 constructor(ast, placeholder, ownStylePropertyNames, elementName, typeExtensio
n, cssBuild) { |
| 48 /** @type {StyleNode} */ |
| 49 this.styleRules = ast || null; |
| 50 /** @type {Node} */ |
| 51 this.placeholder = placeholder || null; |
| 52 /** @type {!Array<string>} */ |
| 53 this.ownStylePropertyNames = ownStylePropertyNames || []; |
| 54 /** @type {Array<Object>} */ |
| 55 this.overrideStyleProperties = null; |
| 56 /** @type {string} */ |
| 57 this.elementName = elementName || ''; |
| 58 /** @type {string} */ |
| 59 this.cssBuild = cssBuild || ''; |
| 60 /** @type {string} */ |
| 61 this.typeExtension = typeExtension || ''; |
| 62 /** @type {Object<string, string>} */ |
| 63 this.styleProperties = null; |
| 64 /** @type {?string} */ |
| 65 this.scopeSelector = null; |
| 66 /** @type {HTMLStyleElement} */ |
| 67 this.customStyle = null; |
| 68 } |
| 69 _getStyleRules() { |
| 70 return this.styleRules; |
| 71 } |
| 72 } |
| 73 |
| 74 StyleInfo.prototype['_getStyleRules'] = StyleInfo.prototype._getStyleRules; |
| OLD | NEW |