From ac80490947da881230f1224efadff8593c8b27af Mon Sep 17 00:00:00 2001 From: Angelina Nguyen Date: Fri, 9 Feb 2024 16:18:56 +1100 Subject: [PATCH] see pr: https://github.com/niklasvh/html2canvas/pull/3097 Squashed commit of the following: commit d2d83ada444f07936243c12f688eeb88d44d4f20 Author: Joey Bloom <15joeybloom@gmail.com> Date: Tue Jul 25 16:34:13 2023 -0500 Set the document clone iframe container's size via the style attribute This prevents CSS rules from overriding the iframe's size which would compromise the screenshot --- src/dom/document-cloner.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dom/document-cloner.ts b/src/dom/document-cloner.ts index 1d5b8b247..26910c4f3 100644 --- a/src/dom/document-cloner.ts +++ b/src/dom/document-cloner.ts @@ -506,6 +506,8 @@ const createIFrameContainer = (ownerDocument: Document, bounds: Bounds): HTMLIFr cloneIframeContainer.style.border = '0'; cloneIframeContainer.width = bounds.width.toString(); cloneIframeContainer.height = bounds.height.toString(); + cloneIframeContainer.style.width = bounds.width.toString() + 'px'; + cloneIframeContainer.style.height = bounds.height.toString() + 'px'; cloneIframeContainer.scrolling = 'no'; // ios won't scroll without it cloneIframeContainer.setAttribute(IGNORE_ATTRIBUTE, 'true'); ownerDocument.body.appendChild(cloneIframeContainer);