(cssText: string, cssBasePath: string)
| 324 | } |
| 325 | |
| 326 | async function createOrUpdateCORSCopy(cssText: string, cssBasePath: string) { |
| 327 | if (cssText) { |
| 328 | // Sometimes cross-origin stylesheets are protected from direct access |
| 329 | // so need to load CSS text and insert it into style element |
| 330 | try { |
| 331 | const fullCSSText = await replaceCSSImports(cssText, cssBasePath); |
| 332 | if (corsCopies.has(element)) { |
| 333 | if ((corsCopiesTextLengths.get(element) ?? 0) < fullCSSText.length) { |
| 334 | corsCopies.get(element)!.replaceSync(fullCSSText); |
| 335 | corsCopiesTextLengths.set(element, fullCSSText.length); |
| 336 | } |
| 337 | } else { |
| 338 | const corsCopy = new CSSStyleSheet(); |
| 339 | corsCopy.replaceSync(fullCSSText); |
| 340 | corsCopies.set(element, corsCopy); |
| 341 | } |
| 342 | } catch (err) { |
| 343 | logWarn(err); |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | function details(options: detailsArgument) { |
| 349 | const rules = getRulesSync(); |
no test coverage detected