fix: preserve repeating-linear-gradient through cssText round-trip#577
Open
Sunyi-000 wants to merge 1 commit intobubkoo:masterfrom
Open
fix: preserve repeating-linear-gradient through cssText round-trip#577Sunyi-000 wants to merge 1 commit intobubkoo:masterfrom
Sunyi-000 wants to merge 1 commit intobubkoo:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #577 +/- ##
=======================================
Coverage 66.50% 66.50%
=======================================
Files 10 10
Lines 612 612
Branches 150 150
=======================================
Hits 407 407
Misses 144 144
Partials 61 61 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
When cloneCSSStyle copies styles via the cssText path (Firefox / Safari), the browser's shorthand serialiser can normalise gradient stop-positions to 0 % / 100 %, making a repeating-linear-gradient render identically to a plain linear-gradient in the exported image. Fix: after assigning cssText, explicitly re-apply background-image using getPropertyValue, which returns the exact computed value and bypasses the shorthand serialiser. Closes bubkoo#571 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6b639ee to
35a6953
Compare
Author
|
Note on Codecov patch coverage: The |
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.
Closes #571
When an element uses repeating-linear-gradient, the exported image renders it as a plain linear-gradient because the browser cssText serialiser normalises stop-positions to 0%/100%.
Fix: after the cssText assignment, explicitly re-apply background-image via getPropertyValue, which returns the exact computed value and bypasses shorthand normalisation.
Test added: regression test bootstraps a fixture with a 20px-tile repeating-linear-gradient via external stylesheet, clones it, and asserts the cloned inline style still contains repeating-linear-gradient.