Skip to content

Multiple & references inside :is(), :where(), :has() not fully resolved #350

@quantizor

Description

@quantizor

Description

When multiple & (parent selector) references appear inside :is(), :where(), or :has() pseudo-class arguments, stylis only resolves the first & but leaves subsequent ones as literal & characters.

Reproduction

import { compile, serialize, stringify } from 'stylis';

const result = compile('.parent .child { :is(&:hover, .other:hover &) .target { color: red; } }');
console.log(serialize(result, stringify));

Expected output

:is(.parent .child:hover, .other:hover .parent .child) .target{color:red;}

Actual output

:is(.parent .child:hover, .other:hover &) .target{color:red;}

The second & in the :is() arguments is not replaced with the parent selector.

Environment

stylis 4.3.6

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