Skip to content

wrong css :is selector result #21169

@neves

Description

@neves

What version of Bun is running?

1.2.18

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

CORRECT

style.css

.foo:is(input) {
   color: red;
 }

bun build --watch ./style.css

output

/* style.css */
.foo:-webkit-any(input) {
  color: red;
}

.foo:-moz-any(input) {
  color: red;
}

.foo:is(input) {
  color: red;
}

WRONG

If I add any modifier to the input selector (id, class, pseudo, ...)

style.css

.foo:is(input:checked) {
   color: red;
 }

bun build --watch ./style.css

output

It collapse together .foo with the inner selector.

/* style.css */
.fooinput:checked {
  color: red;
}

It works fine if I change :is with :where
It also works if I use a list like:

.foo:is(input:checked, input:valid) {
   color: red;
 }

What is the expected behavior?

valid css

What do you see instead?

invalid css

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbundlerSomething to do with the bundlercssCSS parser, bundler-related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions