src/clientVueLoader.js
// Scopes the style tag adding parsing its rules.
Scopes the style tag adding parsing its rules.
Scopes the style tag adding parsing its rules .
async function scopeCss(context, cssAttribute, scopeRuleFunction) {
        const sheet = context.element.sheet;
        const rules = sheet.cssRules;
        for (let i = 0; i < rules.length; ++i) {
            const rule = rules[i];
            if (rule.type === 1) {
                sheet.insertRule(scopeRuleFunction(rule, cssAttribute), i);
                sheet.deleteRule(i + 1);
            } else if (rule.type === 4) {
                let tmpScopedMedia = "";
                for (let j = 0; j < rule.cssRules.length; ++j) {
                    const mediaRule = rule.cssRules[j];
                    if (mediaRule.type === 1) {
                        tmpScopedMedia += scopeRuleFunction(mediaRule, cssAttribute);
                    }
                }
                const mediaScoped = "@media " + rule.conditionText + "{" + tmpScopedMedia + "}";
                sheet.insertRule(mediaScoped, i);
                sheet.deleteRule(i + 1);
            }
        }
    }
async function scopeCss ( context , cssAttribute , scopeRuleFunction ) { const sheet = context . element . sheet ; const rules = sheet . cssRules ; for ( let i = 0 ; i < rules . length ; ++ i ) { const rule = rules [ i ] ; if ( rule . type === 1 ) { sheet . insertRule ( scopeRuleFunction ( rule , cssAttribute ) , i ) ; sheet . deleteRule ( i + 1 ) ; } else if ( rule . type === 4 ) { let tmpScopedMedia = "" ; for ( let j = 0 ; j < rule . cssRules . length ; ++ j ) { const mediaRule = rule . cssRules [ j ] ; if ( mediaRule . type === 1 ) { tmpScopedMedia += scopeRuleFunction ( mediaRule , cssAttribute ) ; } } const mediaScoped = "@media " + rule . conditionText + "{" + tmpScopedMedia + "}" ; sheet . insertRule ( mediaScoped , i ) ; sheet . deleteRule ( i + 1 ) ; } } }
Scopes the style tag adding parsing its rules.
Scopes the style tag adding parsing its rules .