* @param {!Element|!ShadowRoot} cssRoot * @param {!{[key: string]: !Element}} styleMap * @param {string} key * @return {?Element}
(cssRoot, styleMap, key)
| 142 | * @return {?Element} |
| 143 | */ |
| 144 | function getExistingStyleElement(cssRoot, styleMap, key) { |
| 145 | // Already cached. |
| 146 | if (styleMap[key]) { |
| 147 | return styleMap[key]; |
| 148 | } |
| 149 | // Check if the style has already been added by the server layout. |
| 150 | const existing = cssRoot./*OK*/ querySelector(`style[${key}], link[${key}]`); |
| 151 | if (existing) { |
| 152 | styleMap[key] = existing; |
| 153 | return existing; |
| 154 | } |
| 155 | // Nothing found. |
| 156 | return null; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Applies a transformer to the CSS text if it has been registered. |
no outgoing calls
no test coverage detected