Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
selector.walk(node => {
const { type } = node;
if (
type === parseSelector.CLASS ||
type === parseSelector.ID ||
type === parseSelector.ATTRIBUTE ||
type === parseSelector.TAG
) {
interestedNode = node;
return false; /* break */
}
});
if (interestedNode) {
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;
}
}
export function isState(node) {
return node.type === selectorParser.ATTRIBUTE &&
node.namespace === "state";
}
function isClassWithAttributeSelectorNode(selector, i) {
return selector.nodes[i].type === selectorParser.ATTRIBUTE &&
(i === 0 || selector.nodes[i - 1].type !== selectorParser.CLASS);
}
function isSimpleClassSelector(selector) {
export function isAttrNode(node: SelectorParser.Node): node is SelectorParser.Attribute {
if (node.type === SelectorParser.ATTRIBUTE) {
return true;
} else {
return false;
}
}