Add missing space between style and class attributes on line elements#6
Open
dereuromark wants to merge 1 commit into
Open
Conversation
Lines that carry a line style (highlight, diff, focus) rendered as style="..."class='line ...' with no separator. Browsers recover, but HTML sanitizers reject the mangled attribute run - WordPress' wp_kses strips the class list from such lines entirely, breaking gutter padding and accent styling downstream. Acceptance fixtures updated accordingly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Lines that carry a line style (highlight, diff add/remove, focus) render with the class attribute glued onto the quoted style value - no separating space:
HtmlGenerator::buildLineElement()only appends a space after the attribute string, not after the style attribute.Browsers recover from this, so it is easy to miss. Strict HTML sanitizers do not: WordPress'
wp_kses, for example, drops the whole mangled attribute run, so highlighted/diff lines lose theirline line-highlight/line-add/line-removeclasses after sanitization - which breaks line padding, gutter alignment, and any styling keyed to those classes.Fix
Emit a trailing space after the style attribute. The 19 acceptance fixtures that asserted the glued markup verbatim are updated, and a regression test asserts no
"class=/'class=junction remains in generated output.Full suite: 514 passed (PHP 8.3).