Skip to content

:has doesn't work #154

@daelmaak

Description

@daelmaak

We are using JSS in react to define rulesets with selectors like these

const useStyles = createUseStyles((theme) => ({
  category: {
    '&:has(input:checked)': {

In tests we use jsdom@26.1.0 to render components with those styles.

For some reason I don't completely understand, the selector that gets parsed in https://github.com/dperini/nwsapi/blob/master/src/nwsapi.js#L1569 ends up looking like 'input#9yecS.input-0-2-453 input:checked' and the parsing result ends up being:

[
  "input",
  "",
  "",
  "yecS.input-0-2-453 input:checked",
]

This produces invalid selector and when applied produces DOMException.

The interesting thing is that if we remove :has from the original rule, there is no such problem.

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