Open canonex opened 4 years ago
After further investigation I noticed that SVGSVGElement is fully compatible with saveSvgAsPng.
The only real problem is on the preliminary check:
const isElement = obj => obj instanceof HTMLElement || obj instanceof SVGElement;
Of course [object SVGSVGElement] will fail the test.
I can't figure out what this object is instance of but adding a check on nodeName:
const isElement = obj => obj instanceof HTMLElement || obj instanceof SVGElement || obj.nodeName == "svg";
Probably this is not the best way but makes the same code works for Firefox and Chrome.
hi, I have in the HTML:
<object id="myid" data="mySvg.svg" height="100%" ></object>
Then, to get the element:
This works in Firefox but in Chrome I receive an error:
Error: an HTMLElement or SVGElement is required; got [object SVGSVGElement]
svgDom should be an Element...
I don't understand if it's my mistake, a browser problem or a problem with saveSvgAsPng. How can I solve the problem?
Thank you, Riccardo