Skip to content

fix: #280 don’t panic on unparseable inline styles - #282

Merged
noahbald merged 2 commits into
noahbald:mainfrom
j9t:fix/280-minify-styles-unparseable-inline-style
Sep 11, 2026
Merged

noahbald merged 2 commits into
noahbald:mainfrom
j9t:fix/280-minify-styles-unparseable-inline-style

Conversation

@j9t

@j9t j9t commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@noahbald, I felt free to quickly sketch this—feel as free to discard:

MinifyStyles::element collects candidates with has_attribute!(element, Style), which is true for an Attr::Unparsed, but exit_document then required get_attribute_mut!(element_with_style, Style) to yield a parsed stylesheet. Values lightningcss can’t parse trip that expect and abort the process—and since panics abort rather than unwind, it can’t be caught from JS.

This is the continue you suggested in #280: skip those elements, leave the attribute unminified, and don’t err the job.

Covers display:none !ie and *display:none. No IE support implied—the styles pass through untouched. A regression case is added to the minify_styles snapshot test.

(Double-checked, but still relying on some agentic help.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
@j9t

j9t commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

(@noahbald, typos note addressed.)

@noahbald
noahbald merged commit 8f03386 into noahbald:main Sep 11, 2026
42 checks passed
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.

2 participants