How to use the domutils.removeElement function in domutils

To help you get started, we’ve selected a few domutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github broadly / css-inliner / lib / extract_rules.js View on Github external
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({});
}
github broadly / css-inliner / lib / extract_rules.js View on Github external
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({});
}