fix(sdk): preserve semicolons inside inline-style values#1562
Open
calcarazgre646 wants to merge 1 commit into
Open
fix(sdk): preserve semicolons inside inline-style values#1562calcarazgre646 wants to merge 1 commit into
calcarazgre646 wants to merge 1 commit into
Conversation
parseStyleAttr split on every ';', truncating values that legitimately contain one: data URIs, url(), and quoted strings. Editing any inline style on an element whose style carried such a value (e.g. a data-URI background) dropped it, since setStyle re-serializes the whole attribute from the parsed map. Tokenize on ';' only outside quotes and balanced parens, matching the same-package class-style path (cssWriter parseDeclarations) and the server patchStyleAttrString path. Refs heygen-com#1550.
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
parseStyleAttr(model.ts) split the style attribute on every;, so a value that legitimately contains one was truncated: data URIs,url(...), and quoted strings. BecausesetStylere-serializes the whole attribute from the parsed map, editing any inline property on an element whosestylecarried such a value dropped it.With
style="background: url("data:image/svg+xml;base64,…"); opacity: 0.5", asetStyle({ opacity: "1" })producedbackground: url("data:image/svg+xml; opacity: 1(the data URI truncated at its inner;, the background gone). The serverpatch-elementpath preserves it, so the SDK cutover and the legacy path diverge here. This is the DOM-edit serialization-parity gap from #1550.The class-style path already guards this (
mutate.cssstyle.test.ts, "CSS values with semicolons (data URIs)"); the inline-style helper was the sibling left on the naive split.Change
Tokenize on
;only when outside quotes and balanced parens, matching the same-package class-style tokenizer (cssWriter.tsparseDeclarations) and the serverpatchStyleAttrString. No behavior change for values without semicolons.Tests
Three cases in
mutate.test.ts: a data-URI value survives an unrelated property edit, a quoted value containing;survives, and a semicolon-bearing property removes cleanly. Full sdk + studio + core suites green.Refs #1550.