File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 const inliner = newInliner ( ) ;
66 const fontFaces = newFontFaces ( ) ;
77 const images = newImages ( ) ;
8-
8+ const offscreen = {
9+ position : 'fixed' ,
10+ left : '-9999px' ,
11+ visibility : 'hidden' ,
12+ } ;
913 // Default impl options
1014 const defaultOptions = {
1115 // Default is to copy default styles of elements
782786 const base = doc . createElement ( 'base' ) ;
783787 doc . head . appendChild ( base ) ;
784788 const a = doc . createElement ( 'a' ) ;
789+ a . style = offscreen ;
785790 doc . body . appendChild ( a ) ;
786791 base . href = baseUrl ;
787792 a . href = url ;
839844 } ;
840845
841846 svg . appendChild ( image ) ;
847+ svg . style = { ...svg . style , ...offscreen } ;
842848 image . src = uri ;
843849
844850 // Add the SVG to the document body (invisible)
14721478 // render at all with `display: none`, so we have to use `visibility: hidden` with `position: fixed`.
14731479 sandbox = document . createElement ( 'iframe' ) ;
14741480 sandbox . id = 'domtoimage-sandbox-' + util . uid ( ) ;
1475- sandbox . style . visibility = 'hidden' ;
1476- sandbox . style . position = 'fixed' ;
1481+ sandbox . style = offscreen ;
14771482 document . body . appendChild ( sandbox ) ;
14781483
14791484 return tryTechniques (
You can’t perform that action at this time.
0 commit comments