-
Notifications
You must be signed in to change notification settings - Fork 3
Labels
enhancementNew feature or requestNew feature or request
Description
Background
To support advanced CSS features and improve maintainability, a general-purpose CSS Tokenizer and Parser should be introduced under cssom/parsers.
Requirements
- Tokenizer: Implement a tokenizer for CSS that can tokenize input for both stylesheets and inline style declarations.
- Parser: Implement a general parser that can:
- Parse an entire CSS stylesheet.
- Parse a single style declaration (e.g., from a style attribute).
Stylesheet Parsing
- The parser should support the following rule types:
StyleRule(standard style rules)KeyframeRule(for@keyframes)FontFaceRule(for@font-face)MediaRule(for@media)ImportRule(for@import)
Single Style Declaration Parsing
- Should parse style declarations into a map/object of key/value pairs for use with inline styles or style attributes.
- Only key/value extraction is required for declarations.
Acceptance Criteria
- Tokenizer covers all valid CSS tokens used in the above rule types and declarations.
- Parser correctly parses complete stylesheets with the listed rule types.
- Parser can parse a single style declaration into key/value pairs.
- Unit tests for both tokenizer and parser (stylesheet + declaration cases).
References
This feature will lay the groundwork for more robust CSS support throughout the engine.
Copilot
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request