Skip to content

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

@jordan-r-jenkins

Description

@jordan-r-jenkins

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions