Skip to content

Fix CSS @media query parsing error in style elements#119

Open
rursache wants to merge 1 commit intoswhitty:mainfrom
rursache:fix/59-media-query-parsing
Open

Fix CSS @media query parsing error in style elements#119
rursache wants to merge 1 commit intoswhitty:mainfrom
rursache:fix/59-media-query-parsing

Conversation

@rursache
Copy link

Summary

  • Skip unknown CSS @ rules (e.g. @media, @supports) including nested blocks when parsing style sheets
  • Previously the parser would fail when encountering @media queries, printing a parsing error to console
  • The scanner now tracks brace depth to correctly skip over nested rule blocks while continuing to parse surrounding selectors

Test plan

  • Added skipsMediaQueries() test verifying @media blocks are skipped and surrounding selectors are parsed
  • Added skipsNestedAtRules() test verifying doubly-nested @ rules (e.g. @supports containing @media) are skipped
  • All 195 tests pass

Closes #59

Skip unknown CSS @ rules (e.g. @media, @supports) including nested
blocks when parsing style sheets. Previously the parser would fail
when encountering @media queries, printing a parsing error to console.

The scanner now tracks brace depth to correctly skip over nested rule
blocks while continuing to parse surrounding selectors.

Closes swhitty#59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parsing Error

1 participant