From eb40128fd4ffda362546216cc99963e50e9a178b Mon Sep 17 00:00:00 2001 From: pvillaverde Date: Tue, 2 Mar 2021 21:44:41 +0100 Subject: [PATCH] [Feat] Included Shadow Root if any element has it [Feat] Included CSS:first-line pseudoElement --- src/dom-to-image.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dom-to-image.js b/src/dom-to-image.js index 27201ac9..ba2fd194 100644 --- a/src/dom-to-image.js +++ b/src/dom-to-image.js @@ -192,7 +192,7 @@ } function cloneChildren(original, clone, filter) { - var children = original.childNodes; + var children = original.shadowRoot ? original.shadowRoot.childNodes : original.childNodes; if (children.length === 0) return Promise.resolve(clone); return cloneChildrenInOrder(clone, util.asArray(children), filter) @@ -247,9 +247,9 @@ } function clonePseudoElements() { - [':before', ':after'].forEach(function (element) { - clonePseudoElement(element); - }); + [':before', ':after', ':first-line'].forEach(function (element) { + clonePseudoElement(element); + }); function clonePseudoElement(element) { var style = window.getComputedStyle(original, element);