Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: unknown pseudo-class selector ':where(<label>' #128

Open
jordan-r-jenkins opened this issue Oct 2, 2024 · 0 comments
Open

Comments

@jordan-r-jenkins
Copy link

Dependencies:
nwsapi@2.2.12
jsdom@20.0.3
dom-accessibility-api@0.5.16
@testing-library/dom@10.4.0

Our application has the following CSS selector:

  :has(
      :where(
          ${InternalUseOnlyInput},
            ${InternalUseOnlyTextArea},
            ${InternalUseOnlySelect},
            ${InternalUseOnlyFileInput}
            [type="file"],
          ${InternalUseOnlyRangeInput},
        ):disabled
    )
    :where(${InternalUseOnlyLabel}, ${InternalUseOnlyHint}) {
    color: ${textColorTertiary};
    cursor: not-allowed;
  }

nwsapi throws this error message:

SyntaxError: unknown pseudo-class selector ':where(<label>'

Here is the sequence that creates this error:

  • At nwsapi.js:1009, the selector above has a regex match with Patterns.logicalsel performed on it, and returns an array of length 5 named match. The contents are the following:
0. ":has( :where( <input>,<text area>,<select>,<file input>,[type=\"file\"],<range input> ):disabled ) :where(<label>,<hint>)"
1. "has"
2. ":where( <input>,<text area>,<select>,<file input>,[type=\"file\"],<range input> ):disabled ) :where(<label>,<hint>"
3. undefined
4. ""
  • match[2] is used starting at nwsapi.js:1024.

Notice how match[2] is missing a closing parentheses? So it seems the Patterns.logicalsel = /^:(?:(is|where|matches|not|has)(?:\x28\s?([([^\[\]])]|[^()\[\]]|.*)\s?\x29))/i does not correctly match the selector above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant