Skip to content

Problem parsing :is() #211

Closed
Closed
@christophe-ledu

Description

@christophe-ledu

Expected Behaviour

The content of the :is() is a selector itself ( https://developer.mozilla.org/en-US/docs/Web/CSS/:is )

Actual Behaviour

Currently, parsing selector as in the following code split the selector with the , which doesn't work

Reproduce Scenario (including but not limited to)

Using a :is() with a , inside the parenthesis

Steps to Reproduce

Platform and Version

Linux, Node 18

Sample Code that illustrates the problem

import {parse} from "@adobe/css-tools";
console.dir(await parse('.klass:is(:nth-child(1), :nth-child(2)) {margin: 0 !important}'), { depth: 4 });

Logs taken while reproducing problem

yarn node test.js
{
  type: 'stylesheet',
  stylesheet: {
    source: undefined,
    rules: [
      {
        type: 'rule',
        selectors: [ '.klass:is(:nth-child(1)', ':nth-child(2))' ],
        declarations: [ [Object] ],
        position: $0865a9fb4cc365fe$export$2e2bcd8739ae039 {
          start: [Object],
          end: [Object],
          source: ''
        }
      }
    ],
    parsingErrors: []
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions