Extract CSS at-rules, move descriptors under at-rules #1033
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This creates an
atrules
property in CSS extracts that contains at-rules syntax as suggested in #1028. Descriptors associated with an at-rule (and all selectors are associated with an at-rule in practice) now appear under the at-rule definition.The new
atrules
property contains avalue
property when a formal syntax could be extracted from the spec, and adescriptors
array that lists descriptors associated with the at-rule (if any).Breaking change: The former
descriptors
property that appeared at the root level of the extract no longer exists. The same info can be found under theatrules
property.This update also adjusts a couple of tests and adds two new tests on at-rules extraction.
The code can only extract the formal syntax of an at-rule if it is defined in a
<pre class="prod">
block. That is the case in most CSS specs, but some of the definitions are done in<pre>
tags without any class for now (e.g.@counter-style
and@scroll-timeline
). The specs need fixing or the extraction logic needs to also parse mere<pre>
tags (but that seems fragile).As opposed to the structure proposed in #1028, the list of descriptors is not indexed by the descriptor's name.
For instance, the
@container
at-rule would lead to:Creating the pull request as draft as I still need to run additional tests to make sure that the code successfully extracts all known at-rules defined in CSS specs (or that the specs need fixing).