From 67ae396f413b749499611762c2b8978bcee153d7 Mon Sep 17 00:00:00 2001 From: Deepak Date: Tue, 23 Jul 2024 23:44:46 +0530 Subject: [PATCH] Prevent overriding styles on clone node if already a clone node has such styles since we believe these styles are overriden through `adjustCloneNode` option so overriding again to the value from source or parent just reseting the styles overriden through`adjustCloneNode` option --- src/dom-to-image-more.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dom-to-image-more.js b/src/dom-to-image-more.js index 34b9d609..b98c8028 100644 --- a/src/dom-to-image-more.js +++ b/src/dom-to-image-more.js @@ -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 (