Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[syntax-3][cssom-1][selectors-3][mediaqueries-4][cascade-3][css-counter-styles-3] Improve the procedures used for parsing a CSS input #7040

Open
7 of 14 tasks
cdoublev opened this issue Feb 12, 2022 · 2 comments
Labels
css-conditional-5 Current Work css-page-3 Current Work css-syntax-3 cssom-1 Current Work

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented Feb 12, 2022

As a follow up on the second part of this comment, which was about replacing the steps parse a list of component values and match the result against the corresponding grammar, by parse something according to a CSS grammar, I create this (list of) issue(s) (and suggestions) about the parsing procedures used across Syntax, CSSOM, Selectors, Media Queries, etc.

  • fixed in 10d1cea - CSS Syntax is missing <style-block> in the section title 8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions.
  • fixed in 6ab5888 - CSS Syntax associates "style block" to parse a list of declarations instead of parse a <style-block>.
  • fixed in 7d4d5b0 - CSS Counter Styles - (set) CSSCounterStyleRule.<descriptor> should use parse something according to a CSS grammar using the descriptor’s grammar instead of parse a list of component values, otherwise the component values will not be parsed against the grammar of the corresponding descriptor (only the basic syntax will be validated).
  • CSS Syntax defines parse a list of component values as the entry point to parse a stand-alone selector, but parse a selector should be used.
  • CSS Syntax defines parse a list of component values as the entry point to parse Element.media, but parse a media query list should be used.
  • CSS Conditional defines that a CSS processor is considered to support a declaration (consisting of a property and value) if it accepts that declaration: it would be helpfull to refer to parse something according to a CSS grammar using the grammar of the property, or to parse a CSS value.
  • CSSOM defines parse a CSS value for parsing a property declaration value: parse a CSS property value seems a more correct name because the procedure receives a property and what is a CSS value is not defined anywhere: at least, it can also be a CSS descriptor value.
  • CSSOM defines parse a CSS value with parse a list of component values composed with match [the result] against the grammar for the property property in the CSS specification but it could refer to parse something according to a CSS grammar using the property’s grammar instead.
  • fixed in [cssom-1] Avoid validating declarations twice #9831 - CSSOM defines parse a CSS declaration block with let parsed declaration be the result of parsing declaration according to the appropriate CSS specifications, dropping parts that are said to be ignored, but this step could be replaced by parse something according to a CSS grammar with the property’s grammar, or by parse a CSS value with the property and its value.
  • invalid: it can also be used for other rules than style rules - Parse a CSS declaration block could be named parse a CSS style block contents because a "block" implies the presence of its associated tokens whereas this procedure only takes the contents of the block, which also accepts (but ignores) nested rules.
  • CSS Page defines that @page rules are parsed with parse something according to a CSS grammar but this algorithm does not expect a high level rule object resulting from consuming stylesheet's contents
  • fixed in 6ab5888 - CSS Cascade defines fetch an @import (removed in Cascade 5) with a step that includes parse a stylesheet but it would be helpfull to note that only the basic syntax will be validated, or to define that parse a CSS style sheet should be used, otherwise the list of rules will not be parsed against the context rules or the corresponding grammar for the rule (only the basic syntax will be validated and the nested rule's contents will be left unparsed as a list of component values).
  • CSS Syntax does not define where/when parse a CSS stylesheet should run (dedicated issue: #2997) and its return value.
  • invalid: see [mediaqueries-5] Parsing <media-query-list> when the input is <whitespace-token> #9173 - CSS Media Queries defines the procedure to parse <media-query-list> with parse a comma-separated list of component values composed with parse something according to a CSS grammar using <media-query>, but it should use parse a comma-separated list according to a CSS grammar using <media-query> instead, therefore parsing a whitespace as input (eg. from Element.media) to an empty list instead of not all (as defined in parse a media query or a media query list), and it should define this production specific rule: an empty list should default to all and an invalid <media-query> should default to not all.
@cdoublev
Copy link
Collaborator Author

I improved the sorting in my previous comment to put the less important items first. I removed two items that already have a dedicated issue and didn't provide additional details, and added one about parsing @page.

@w3c w3c deleted a comment from sam092singh Mar 2, 2022
tabatkins added a commit that referenced this issue May 25, 2023
…to use the CSS/parse algorithm rather than doing using bespoke language. #7040
@tabatkins tabatkins removed the css-counter-styles-3 Current Work label May 25, 2023
@tabatkins
Copy link
Member

Fixed the Counter Styles issue. (and marked it as completed in your list) I consider the change editorial; I was just using bespoke language for the operation rather than invoking the algorithm designed for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-conditional-5 Current Work css-page-3 Current Work css-syntax-3 cssom-1 Current Work
3 participants