Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

HTMLElement or SVGElement in Chrome #250

@canonex

Description

@canonex

hi,
I have in the HTML:

<object id="myid" data="mySvg.svg" height="100%" ></object>

Then, to get the element:

let svgObject = document.getElementById( "myid" );
let svgDom = svgObject.contentDocument.querySelector("svg");

saveSvgAsPng(svgDom, "myname.png");

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions