Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
isTypeMatching(node) {
switch (node.type) {
case selectorParser.TAG:
return this.findMatchingSibling(node, node => {
return node.value === this.currentNode.tag;
});
case selectorParser.COMBINATOR:
return this.isCombinatorMatching(node);
case selectorParser.CLASS:
return this.findMatchingSibling(node, node => (this.currentNode.class || '').split(' ').includes(node.value));
case selectorParser.ATTRIBUTE:
return this.findMatchingSibling(node, node => this.isAttributeMatching(node));
case selectorParser.PSEUDO:
if (node.value === ':root') {
this.toParent();
this.updateCurrentSiblings();
return Object.keys(this.currentNode).length === 0;
}
return true;
default:
return false;
}
}
selector.each((s) => {
if (s.type === selectorParser.PSEUDO && s.value === ":state") {
let info = stateParser(rule, s);
if (info.group) {
states.add(`${info.group} ${info.name}`);
} else {
states.add(info.name);
}
} else if (s.type === selectorParser.COMBINATOR) {
combinators.add(s.value);
}
return true;
});
if (combinators.size > 0 && states.size > 1) {
function isOnlyPseudoRootSelector(selector) {
return selector.nodes.length === 1 && selector.first.type === selectorParser.PSEUDO &&
selector.first.value === ':root';
}