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

href vs xlink:href issue in bboxUtils.js #55

Open
killroy42 opened this issue Mar 6, 2020 · 2 comments
Open

href vs xlink:href issue in bboxUtils.js #55

killroy42 opened this issue Mar 6, 2020 · 2 comments

Comments

@killroy42
Copy link

I got an (node:3708) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'slice' of null error for this SVG fragment:
<use xlink:href="#SVGID_1_" style="overflow:visible;"/>

I tracked it down to this code in line 57:
let ref = node.getAttribute('href')

Quickly changing it to let ref = node.getAttribute('href') || node.getAttribute('xlink:href') made it work for my case. I'm not familiar enough to suggest this as a general fix, but perhaps somebody more familiar with the meaning behind "href" and "xlink:href" could take a look at this?

@Fuzzyma
Copy link
Member

Fuzzyma commented Mar 7, 2020

Jeah, namespaces... thats a thing :D. Can you please post the code which led to the call of getAttribute?

@killroy42
Copy link
Author

It was a call to .getBBox() on an svg element that contained an element with a xlink:href="..." property.

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

No branches or pull requests

2 participants