Comments (6)
Looks like you're filtering out the node you want to render. Make sure your filter matches that node.
from dom-to-image.
It doesn't matter what I'm actually trying to filter out - returning false from filter in any case results in node
being undefined later in Promise chain. Maybe I misunderstand how the library is designed - but what I'm trying to do is give it a container with mixed dom objects in it, and filter function would return true or false for those I want included in resulting svg/foreignobject sandwich, and skip all the others.
I "fixed" it by changing this line:
From:
if (filter && !filter(node)) return Promise.resolve();
To:
if (filter && !filter(node)) return Promise.resolve(document.createElement( 'b' ));
Now there's no exception, and it ends up rendering empty/invisible <b/>
instead. But it seems to be a deeper problem here - promise.resolve requires node to be defined later.
from dom-to-image.
Take a look at this test to see how filter should be used. When calling toSvg, you should provide the node you want to render. If your filter does not return true for the node you've provided as first argument, then you'll get this error. Perhaps this situation should be handled better. But if you give right arguments (and make sure that root node passes the filter), your problem should be fixed
from dom-to-image.
Now it makes sense! My filter should've included the container node as well as the things I'm filtering in / out.
Thank you for clearing this up.
from dom-to-image.
welcome :)
from dom-to-image.
FYI, starting from 2.1.0 this issue is handled better, the filter is no longer applied to the root node.
from dom-to-image.
Related Issues (20)
- Most of the issues have been fixed in forked library `modern-screenshot` HOT 4
- toPng() throw error. HOT 8
- Super long HTML growth chart - Node images with height exceeding 16000 are blank HOT 2
- DomToPNG not working if dom contains %BB
- dom to image giving blank images HOT 3
- How to keep ratio without adding blank space around the image HOT 1
- Rendering svg
- The internal picture is blank
- Cookies not passed to image request
- It not support xlink:href for svg? HOT 1
- When there is a large DOM content, empty file download happening. Are there any limitations? HOT 3
- the image some time cutting and some time show correct HOT 1
- sometimes image in HTML is big,domtoimage will show blank image in IOS not Android
- DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported
- DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported HOT 1
- Full Scrollable (CLOSED)
- shadow-root not rendered. HOT 1
- Exporting to PNG does not check checkboxes
- domtoimage doesn't work on vector layer
- Error while converting dom to image HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dom-to-image.