function rewriteStyleTagsBaseUrl(ast, oldBaseUrl, newBaseUrl, rewriteUrlsInTemplates = false) {
    const childNodesOption = rewriteUrlsInTemplates ?
        dom5.childNodesIncludeTemplate :
        dom5.defaultChildNodes;
    // If `rewriteUrlsInTemplates` is `true`, include `<style>` tags that are
    // inside `<template>`.
    const styleNodes = dom5.queryAll(ast, matchers.styleMatcher, undefined, childNodesOption);
    // Unless rewriteUrlsInTemplates is on, if a `<style>` tag is anywhere
    // inside a `<dom-module>` tag, then it should not have its urls rewritten.
    if (!rewriteUrlsInTemplates) {
        for (const domModule of dom5.queryAll(ast, dom5.predicates.hasTagName('dom-module'))) {
            for (const styleNode of dom5.queryAll(domModule, matchers.styleMatcher, undefined, childNodesOption)) {
                const styleNodeIndex = styleNodes.indexOf(styleNode);
                if (styleNodeIndex > -1) {
                    styleNodes.splice(styleNodeIndex, 1);
                }
            }
        }
    }
    for (const node of styleNodes) {
        let styleText = dom5.getTextContent(node);
        styleText = rewriteCssTextBaseUrl(styleText, oldBaseUrl, newBaseUrl);
        dom5.setTextContent(node, styleText);
    }
}
/**
 * Find all urls in imported style nodes and rewrite them so they are based
 * on the relationship of the old base url to the new base url.
 */
Find all urls in imported style nodes and rewrite them so they are based
on the relationship of the old base url to the new base url.
Find all urls in imported style nodes and rewrite them so they are based on the relationship of the old base url to the new base url .
function rewriteStyleTagsBaseUrl(ast, oldBaseUrl, newBaseUrl, rewriteUrlsInTemplates = false) {
    const childNodesOption = rewriteUrlsInTemplates ?
        dom5.childNodesIncludeTemplate :
        dom5.defaultChildNodes;
    const styleNodes = dom5.queryAll(ast, matchers.styleMatcher, undefined, childNodesOption);
    if (!rewriteUrlsInTemplates) {
        for (const domModule of dom5.queryAll(ast, dom5.predicates.hasTagName('dom-module'))) {
            for (const styleNode of dom5.queryAll(domModule, matchers.styleMatcher, undefined, childNodesOption)) {
                const styleNodeIndex = styleNodes.indexOf(styleNode);
                if (styleNodeIndex > -1) {
                    styleNodes.splice(styleNodeIndex, 1);
                }
            }
        }
    }
    for (const node of styleNodes) {
        let styleText = dom5.getTextContent(node);
        styleText = rewriteCssTextBaseUrl(styleText, oldBaseUrl, newBaseUrl);
        dom5.setTextContent(node, styleText);
    }
}
function rewriteStyleTagsBaseUrl ( ast , oldBaseUrl , newBaseUrl , rewriteUrlsInTemplates = false ) { const childNodesOption = rewriteUrlsInTemplates ? dom5 . childNodesIncludeTemplate : dom5 . defaultChildNodes ; const styleNodes = dom5 . queryAll ( ast , matchers . styleMatcher , undefined , childNodesOption ) ; if ( ! rewriteUrlsInTemplates ) { for ( const domModule of dom5 . queryAll ( ast , dom5 . predicates . hasTagName ( 'dom-module' ) ) ) { for ( const styleNode of dom5 . queryAll ( domModule , matchers . styleMatcher , undefined , childNodesOption ) ) { const styleNodeIndex = styleNodes . indexOf ( styleNode ) ; if ( styleNodeIndex > - 1 ) { styleNodes . splice ( styleNodeIndex , 1 ) ; } } } } for ( const node of styleNodes ) { let styleText = dom5 . getTextContent ( node ) ; styleText = rewriteCssTextBaseUrl ( styleText , oldBaseUrl , newBaseUrl ) ; dom5 . setTextContent ( node , styleText ) ; } }
Find all urls in imported style nodes and rewrite them so they are based
 on the relationship of the old base url to the new base url.
Find all urls in imported style nodes and rewrite them so they are based on the relationship of the old base url to the new base url .
// If `rewriteUrlsInTemplates` is `true`, include `<style>` tags that are // inside `<template>`. // Unless rewriteUrlsInTemplates is on, if a `<style>` tag is anywhere // inside a `<dom-module>` tag, then it should not have its urls rewritten.