Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// clean up now emtpy
csso.walk(itemRulesetNodeCloned, _fetchDeclarations);
csso.walk(inlineCssAst, _fetchDeclarations);
// sort by !important(ce)
var mergedDeclarationsSorted = stable(mergedDeclarations, function (declarationA, declarationB) {
var declarationAScore = ~~declarationA.data.value.important, // (cast boolean to number)
declarationBScore = ~~declarationB.data.value.important; // "
return (declarationAScore - declarationBScore);
});
// to css
for (var mergedDeclarationsSortedIndex in mergedDeclarationsSorted) {
var declaration = mergedDeclarationsSorted[mergedDeclarationsSortedIndex];
newInlineCssAst.declarations.insert(declaration);
}
var newCss = csso.translate(newInlineCssAst);
elInlineStyleAttr.value = newCss;
selectedEl.addAttr(elInlineStyleAttr);
}
if (removeMatchedSelectors && selectedEls !== null && selectedEls.length > 0) {
// clean up matching simple selectors if option removeMatchedSelectors is enabled
selectorItem.rulesetNode.selector.selectors.remove(selectorItem.simpleSelectorItem);
}
}
var styleItemIndex: any = 0,
styleItem: any = {};
for (styleItemIndex in styleItems) {
styleItem = styleItems[styleItemIndex];
var selectorItemsMqs = selectorItems.filter(function (selectorItem) {
if (selectorItem.atRuleExpNode === null) {
return true;
}
var mqStr = csso.translate(selectorItem.atRuleExpNode);
return useMqs.indexOf(mqStr) > -1;
});
}
}
}
try {
ast = CSSO.compress(ast);
} catch (error) {
config.out.warn("CSS compression error: ");
config.out.warn(error.message);
}
try {
ast = CSSO.cleanInfo(ast);
} catch (error) {
config.out.warn("CSS clean info error:");
config.out.warn(error.message);
}
return CSSO.translate(ast);
}
try {
ast = CSSO.compress(ast);
} catch (error) {
config.out.warn("CSS compression error: " + file.path);
config.out.warn(error.message);
}
try {
ast = CSSO.cleanInfo(ast);
} catch (error) {
config.out.warn("CSS clean info error: " + file.path);
config.out.warn(error.message);
}
return CSSO.translate(ast);
}
{
cssSourceClassNames[identName] = ident;
ident[3] = 1;
}
else
{
part[2] = cssSourceClassNames[identName];
cssSourceClassNames[identName][3]++;
}
}
}
break;
case 'uri':
treeConsole.log('+ ' + csso.translate(csso.cleanInfo(token)));
resourceUriMap.push({
baseURI: baseURI,
token: token
});
break;
default:
walkTree(token, 2);
break;
}
}
}