Skip to content

Parse the text of a style element as one style sheet - #279

Merged
eXpl0it3r merged 1 commit into
masterfrom
fix/style-less-than
Nov 10, 2026
Merged

eXpl0it3r merged 1 commit into
masterfrom
fix/style-less-than

Conversation

@eXpl0it3r

Copy link
Copy Markdown
Collaborator

A less-than sign inside a <style> element split its text into several style sheets, e.g. @media (width < 600px) { p { color: red } } or p::before { content: "<" }. Each piece got parsed on its own, so rules after the < were lost and some inputs made SetHtml throw. HtmlKit emits a separate data token at every < in raw text, and HtmlParser created a new text box for each token. As such, consecutive data tokens are now appended to the preceding text box, the same way the HTML tree builder appends characters to the previous Text node.

How to test this PR?

CI should succeed. RealWorldTests.StyleElement_TextWithLessThanSign_IsOneStyleSheet covers a < in a custom property, in content and in a media range query, and fails on master.

@eXpl0it3r
eXpl0it3r merged commit fe32f7d into master Nov 10, 2026
18 checks passed
@eXpl0it3r
eXpl0it3r deleted the fix/style-less-than branch November 10, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant