question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bad handling of namespaces in innerHTML setter

See original GitHub issue

https://github.com/mathjax/MathJax-node/issues/15

The following code :

jsdom = require('jsdom');
doc = jsdom.jsdom();
doc.body.innerHTML = "<svg xmlns:xlink='http://www.w3.org/1999/xlink'><use xlink:href='#test'></use></svg>";
console.log(doc.body.innerHTML);

When run with jsdom 0.11.1 returns (same as Firefox with some basic console testing) :

<svg xmlns:xlink='http://www.w3.org/1999/xlink'><use xlink:href='#test'></use></svg>

However, jsdom 1.0.0-pre.1 returns :

<svg xlink="http://www.w3.org/1999/xlink"><use href="#test"></use></svg>

where namespaces are stripped.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
domeniccommented, May 24, 2016

This is fixed, as shown by the commit above that closed it.

0reactions
shawnbotcommented, May 24, 2016

Has this been fixed, or is this specific part still an issue? I think that I’m seeing the innerHTML namespace issues, but I’m not entirely sure.

@domenic We will have to do something about that eventually, since the current handling with htmlparser2 produces invalid localNames and no namespaceURIs. 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

155723 - innerHTML will need to be fixed to work with XHTML
The browser will render that fine when the result tree has no namespace and the host document is XHTML which is actually wrong...
Read more >
innerHTML unencodes &lt; in attributes - Stack Overflow
I'm assuming that the DOM implementation decided that HTML attributes can be less strict than XML attributes, and that this is "working as ......
Read more >
HTML 5 - W3C
If the root element is an svg element in the " http://www.w3.org/2000/svg " namespace, and the user agent supports SVG, then the setter...
Read more >
What is the Disadvantage of using innerHTML in JavaScript
Can break the document: There is no proper validation provided by innerHTML, so any valid HTML code can be used. This may break...
Read more >
HTML from Strings and XSS - Beginner JavaScript - Wes Bos
You can see that innerHTML is a string of all the HTML that makes up what is inside of it. That is a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found