browserslist / browserslist

🦔 Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-preset-env

Home Page:https://browsersl.ist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

usage query does not respect preceeding queries in a union

kirkwaiblinger opened this issue · comments

For some reason this browserlistrc (playground link)

chrome 95
last 1 chrome major versions and > 0.05%

gives only chrome 116 as a target.
whereas this one (playground link)

last 1 chrome major versions and > 0.05%
chrome 95

gives chrome 116 and chrome 95.

I observe the same behavior if I use commas, or if I use a single line with or combinator. I would expect that each line is treated as a union and therefore both variants would output chrome 116 and chrome 95.

Sorry, it is how it works, and we can’t change it without major release (which is painful for the ecosystem).

and applies to a previous selector and reduce it.

Oh, so this is intentional? I guess I'm confused, then...
So, is that to say "and" anywhere in the config has lowest precedence, and there's no way to group queries with parenthesis or something?
I have previously written a query like

last 3 chrome major versions and > 0.1%
last 3 edge major versions and > 0.05%

Should I understand that that is parsed like

# ignore the fact that parens are not valid
((last 3 chrome major versions and > 0.1%) or last 3 edge major versions) and > 0.05%

# which would be equal to 
(last 3 chrome major versions or last 3 edge major versions) and > 0.05%

# which implies writing this would have had the same effect from the start, ignoring the desired looser condition on chrome?
last 3 chrome major versions
last 3 edge major versions and > 0.05%

# But this is not equivalent?
last 3 chrome major versions
last 3 edge major versions
>0.05%

# And this isn't valid??
last 3 chrome major versions
last 3 edge major versions
and > 0.05%

Oh, so this is intentional?

I would say that the PR with and has no good research before and this is a result

And this isn't valid??

Yes, query can’t be started from and

Huh. More you learn