openstyles / stylus

Stylus - Userstyles Manager
https://add0n.com/stylus.html
GNU General Public License v3.0
5.5k stars 306 forks source link

[Bug] Parsing error when using :is() or :not() pseudoselectors #1719

Closed wykopx closed 11 months ago

wykopx commented 11 months ago

Bug Report

Bug Description

using :not() and :is() both gives an error in the same way Erros is happening when you

When all above conditions are met you will get an error:

Expected "}" but found ")".
Unexpected ")".
Unexpected "}".

Screenshots

image

CSS Code

EXAMPLE 1 :not() - this gives an error:

    div:not(.test1, .test2),
    div:not(.test1, .test2) > span
    {
        color: red;
    }

EXAMPLE 2 :is() - this gives an error:

    div:is(.test, .test1), // uncomment this line to get an error
    div:is(.test, .test2) > span
    {
        color: red;
    }

When you change order for test classes and "first class" in the first selector is different than "first class" in second selector this works fine:

    div:is(.test1, .test),
    div:is(.test2, .test) > span,
    {
        color: green;
    }

WORKAROUND It's enough to give some dummy class that we don't even need as the first class and it works:

    div:is(.dummy, .test, .test2),
    div:is(.test, .test2) > span,
    {
        color: green;
    }

System Information

Additional information:

I prepared test Userstyle that shows this error:

https://userstyles.world/style/13700/is-selector-causing-an-error

tophf commented 11 months ago

It's an upstream bug in the preprocessor, please see https://github.com/openstyles/stylus/discussions/1710