Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG image not parsed/created inside jsonmlParse #253

Closed
gabrielrad opened this issue Sep 2, 2019 · 3 comments
Closed

SVG image not parsed/created inside jsonmlParse #253

gabrielrad opened this issue Sep 2, 2019 · 3 comments

Comments

@gabrielrad
Copy link

Inside the jsonmlParse function, innerHTML it's used to parse the content returned by onmlStringify and create a svg image child:

function jsonmlParse (arr) {
    var el = document.createElementNS(w3.svg, 'g');
    el.innerHTML = onmlStringify(arr);
    return el.childNodes[0];
}

My user agent is Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.15 (KHTML, like Gecko) Version/8.0 Safari/538.15 and it does not parse the content assigned to innerHTML.

I solved this problem by doing the following:

function jsonmlParse (arr) {
    arr[1].xmlns = "http://www.w3.org/2000/svg";
    arr[1]['xmlns:xlink'] = "http://www.w3.org/1999/xlink";
    var svgStringify = onmlStringify(arr).replace(/&/g, "&");
    var doc = new DOMParser().parseFromString(svgStringify, "image/svg+xml");
    return doc.firstChild;
}

Can this make it in a feature release? Thanks.

@drom
Copy link
Member

drom commented Nov 28, 2019

Please try new version.

@gabrielrad
Copy link
Author

Thank you very much!

@gabrielrad
Copy link
Author

@drom Can I ask you when it will be the next official release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants