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.

Issue with tagName case-sensitivity when creating SVG content.

See original GitHub issue

I am using jsdom in paper.js to export SVG content. In order to export gradients, I am using the following command to create a SVG linearGradient node:

document.createElementNS('http://www.w3.org/2000/svg', 'linearGradient')

This results in a tag <lineargradient> in the output, so with a lowercased tagName, which is then not recognized by SVG parsers.

I assume this is a bug in jsdom?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:25 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
purple-forcecommented, May 16, 2019

A little different. When i set the attribute of svg by setAttribute(‘viewBox’, ‘0 0 1024 1024’), the output is viewbox,it is lowercase and not recoginzed by browers. My jsdom is v14.1.0@Domenic Denicola

1reaction
lehnicommented, Jan 7, 2016

This doesn’t seem to be fully fixed unfortunately. The following still produces lowercased tag names:

var node = document.createElementNS('http://www.w3.org/2000/svg', 'textPath');
var str = jsdom.serializeDocument(node);
console.log(str);
<textpath></textpath>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Re: Case-Sensitivity & SVG-in-HTML5 - Mailing lists - W3C
SVG elements are not in the HTML namespace and therefor should be case sensitive: """ Element nodes in the HTML namespace whose local...
Read more >
JavaScript createElementNS and SVG - Stack Overflow
In particular I have problems creating a element. As it will be appended as <textpath> and thus will not work. I did some...
Read more >
John Resig - .nodeName Case Sensitivity
.nodeName Case Sensitivity · The node names of HTML elements are always uppercase, even if they're explicitly created using lowercase characters.
Read more >
Using str.replace() to fix clipPath case-sensitivity makes SVG ...
The remaining problem with output2.svg is that the <use> reference in your clip path element wasn't correct. What I did: <clippath> -> <clipPath> ......
Read more >
дэн on Twitter: "However, if you're creating SVG with ...
Today I learned how tag case sensitivity works in DOM and SVG. ... You can pass tag with any casing to createElement(). It...
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