Skip to content

Commit

Permalink
Merge pull request #175 from codesculpture/prevent/target/styles
Browse files Browse the repository at this point in the history
Prevent overriding styles on clone node if already style exists
  • Loading branch information
IDisposable authored Jul 23, 2024
2 parents 2a0acf5 + 67ae396 commit 705acf7
Showing 1 changed file with 4 additions and 0 deletions.
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

0 comments on commit 705acf7

Please sign in to comment.