Description#
Integrate CSS parsing with the HTML pipeline. Extract CSS from <style> elements and style attributes, parse them, and feed them into the style resolution system.
Acceptance Criteria#
- During DOM construction or as a post-processing step:
- Find all
<style>elements in the document - Extract their text content
- Parse each as a CSS stylesheet using the CSS parser
- Find all
- Parse inline
styleattributes on elements into declaration blocks - Collect all stylesheets in document order
- Pass collected stylesheets + DOM to the style resolver
- Update the browser pipeline (in
browsercrate) to:- Parse HTML → DOM
- Extract and parse CSS from
<style>elements - Resolve styles (cascade)
- Pass styled tree to layout
- Write integration tests: HTML with
<style>block renders with correct styles
Dependencies#
- CSS parser
- Cascade and computed style resolution
- HTML parser / DOM
Implementation Notes#
<link rel="stylesheet">is deferred to Phase 8 (requires network)- For now, only
<style>elements and inlinestyleattributes