Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent overriding styles on clone node if already style exists #175

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/dom-to-image-more.js
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,10 @@
? parentComputedStyles.getPropertyValue(name)
: undefined;

// Ignore setting style property on clone node, if already it has a style (through adjustCloneNode)
const targetValue = targetStyle.getPropertyValue(name);
if(targetValue) return;

// If the style does not match the default, or it does not match the parent's, set it. We don't know which
// styles are inherited from the parent and which aren't, so we have to always check both.
if (
Expand Down
Loading