Bad handling of namespaces in innerHTML setter
See original GitHub issuehttps://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:
- Created 9 years ago
- Comments:5 (4 by maintainers)
Top 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 < 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is fixed, as shown by the commit above that closed it.
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.