Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function extractFromElementAsync(cache, element) {
if (isStyleElement(element)) {
DOMUtils.removeElement(element);
const css = DOMUtils.getText(element);
const resultPromise = cache.compileAsync(css);
return resultPromise;
} else if (isLocalStylesheet(element)) {
DOMUtils.removeElement(element);
const relativeURL = DOMUtils.getAttributeValue(element, 'href');
const resultPromise = cache.loadAsync(relativeURL);
return resultPromise;
} else
return Promise.resolve({});
}
function extractFromElementAsync(cache, element) {
if (isStyleElement(element)) {
DOMUtils.removeElement(element);
const css = DOMUtils.getText(element);
const resultPromise = cache.compileAsync(css);
return resultPromise;
} else if (isLocalStylesheet(element)) {
DOMUtils.removeElement(element);
const relativeURL = DOMUtils.getAttributeValue(element, 'href');
const resultPromise = cache.loadAsync(relativeURL);
return resultPromise;
} else
return Promise.resolve({});
}