less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17.02k stars 3.41k forks source link

Fails to parse CSS Selectors Level 4 extensions to :not selectors for compound rulesets #3640

Closed rjgotten closed 3 years ago

rjgotten commented 3 years ago

Version 4.1.1 - i.e. current as of this writing - and earlier of Less seems to improperly handle parsing of the :not pseudo-selector, which causes it throw the error "Missing a closing ')'" when encountering a CSS Selectors Level 4 compound :not - e.g.

:not(.foo, .bar) {
}

My guess is that the parser component for selector rulesets does a naïve global split based on comma characters into constituent selector rules to process. If this is the case, then it needs to implement a proper front-to-back parse of the whole thing instead, as that would allow it to detect whether the comma occurs within the nested context of a pseudo-selector or not.

iChenLei commented 3 years ago

Duplicate #3622 , more detail https://github.com/less/less.js/issues/3622#issuecomment-875251159

Less v5 development is working in progress, https://github.com/matthew-dean/less.js/tree/5.x . Matthew (current core maintainer) use chevrotain to write new less parser, so he doesn't have much time to fix less 4.x .

matthew-dean commented 3 years ago

Less v5 development is working in progress, https://github.com/matthew-dean/less.js/tree/5.x . Matthew (current core maintainer) use chevrotain to write new less parser, so he doesn't have much time to fix less 4.x .

@iChenLei Please don't take the existence of that branch as proof that a Less v5 release will happen (based on that branch). We can discuss on Gitter if you like; it's unrelated to this issue.

We should close this as a dupe of #3622, I think?

iChenLei commented 3 years ago

Sorry, Sir. My fault.