Skip to content

Commit

Permalink
Move pseudo classes to const
Browse files Browse the repository at this point in the history
  • Loading branch information
scripthunter7 committed Feb 19, 2023
1 parent 203183b commit 7f11dc7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/syntax/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import { fork as originalFork, tokenize as originalTokenize, tokenTypes } from "css-tree";
import { CLOSING_PARENTHESIS, DOUBLE_QUOTE, ESCAPE, OPENING_PARENTHESIS, SPACE } from "../utils/constants.js";

const CONTAINS_PSEUDO_CLASSES = ["contains(", "-abp-contains(", "has-text("];

const selector = {
parse() {
return this.createSingleNodeList(this.Selector());
Expand Down Expand Up @@ -131,10 +133,7 @@ const extCssContains = {

for (let i = this.tokenIndex; i >= 0; i--) {
// Check token name to avoid :contains(join('')) case, where join( is also a function token
if (
tokens[i].type === "function-token" &&
["contains(", "-abp-contains(", "has-text("].includes(tokens[i].chunk)
) {
if (tokens[i].type === "function-token" && CONTAINS_PSEUDO_CLASSES.includes(tokens[i].chunk)) {
// Token after the function name is the first token of the argument
startPosition = this.getTokenStart(i + 1);
prevTokenIndex = i + 1;
Expand Down

0 comments on commit 7f11dc7

Please sign in to comment.