Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
parseSelector(resolvedSelector, result, rule, (selectorTree) => {
// Check if the selector specificity exceeds the allowed maximum
if (
specificity.compare(maxChildSpecificity(selectorTree), maxSpecificityArray) === 1
) {
report({
ruleName,
result,
node: rule,
message: messages.expected(resolvedSelector, max),
word: selector,
});
}
});
} catch (e) {
var selectorItemsSorted = stable(selectorItemsPseudoClasses, function (itemA, itemB) {
return specificity.compare(itemA.selectorStr, itemB.selectorStr);
}).reverse(); // last declaration applies last (final)
node.reduce((max, child) => {
const childSpecificity = nodeSpecificity(child); // eslint-disable-line no-use-before-define
return specificity.compare(childSpecificity, max) === 1 ? childSpecificity : max;
}, zeroSpecificity());
Object.keys(styleObj).sort((a, b) => {
const aArray = a.split('~');
const bArray = b.split('~');
return specificity.compare(aArray[0], bArray[0]) ||
parseFloat(aArray[1]) - parseFloat(bArray[1]) ||
parseFloat(aArray[2]) - parseFloat(bArray[2]) ||
aArray.length - bArray.length ||
parseFloat(aArray[3]) - parseFloat(bArray[3]);
}).forEach(key => {
style += styleObj[key];
this.selectorTree = new BSTree((s1, s2) => {
let cmp = specificity.compare(s1.specificity.specificityArray, s2.specificity.specificityArray);
if (cmp === 0) cmp = compare(s1.fileIndex, s2.fileIndex);
if (cmp === 0) cmp = compare(s1.sourceIndex, s2.sourceIndex);
return cmp;
});
this.elementSelectors = new Map();
selector => compare(selector.value, maxSpecificitySelector.value) === 0
)
selectorArr.forEach(v => {
if (compare(v, _selector) === 1) {
_selector = v;
}
});
} else {
this.matchedSelectors.sort((a, b) => {
let cmp = specificity.compare(a.specificity.specificityArray,
b.specificity.specificityArray);
if (cmp === 0) {
return (indexMap.get(a)! < indexMap.get(b)!) ? -1 : 1;
} else {
return cmp;
}
});
}
priorComparableSelectors.forEach((priorEntry) => {
if (specificity.compare(selectorSpecificity, priorEntry.specificity) === -1) {
report({
ruleName,
result,
node: rule,
message: messages.rejected(selector, priorEntry.selector),
index: sourceIndex,
});
}
});