csslib icon indicating copy to clipboard operation
csslib copied to clipboard

Support Selectors Level 4 Grammar

Open leonsenft opened this issue 4 years ago • 0 comments

I believe the parser currently implements Selectors Level 3 grammar (it at least makes reference to it throughout the code).

Unfortunately Selectors Level 3 has very limited support for parsing pseudo-class functions (see definitions for pseudo, functional_pseudo and expression in the grammar). This led to the introduction of a hardcoded list of exceptions to support pseudo-class functions with selector arguments. The original exceptions were to support Shadow DOM (:host and :host-context), but https://github.com/dart-lang/csslib/pull/138 introduced a custom pseudo-class function not a part of any CSS specification for use in Angular.

The code in question lives here: https://github.com/dart-lang/csslib/blob/02abc1ddf93092efef2be365300f15504d23cd23/lib/parser.dart#L1543-L1594

Updating the parser to support Selectors Level 4 grammar would alleviate the need for these hardcoded exceptions, as it is much more permissive with pseudo-class function arguments.

leonsenft avatar Nov 05 '21 00:11 leonsenft