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.

SVG tags' shapes lose their closing tags

See original GitHub issue
var cheerio = require('cheerio');
var $ = cheerio.load('<svg><symbol><circle></circle></symbol><g><rect></rect></g><path></path></svg>');
console.log($.html());
//=> '<svg><symbol><circle></symbol><g><rect></g><path></svg>'

Using 0.17.0, <circle>, <rect>, and <path> lose their closing tags.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
fb55commented, Jun 15, 2014

They are self-closing in SVG, so your document should still render properly. If you’re working with an XML document, try passing the xmlMode option.

0reactions
kaemucommented, Mar 24, 2015

Thank you for the fix #673. It’s ok for most of the tags (path, line, polyline…) excepted <polygon> which is not closed, and break the svg.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid HTML1500 Tag cannot be self-closing warning ...
A lot of svg-elements can arguably be self-closing. However, these same elements (including basic shapes) often support animation elements, ...
Read more >
How to Simplify SVG Code Using Basic Shapes - CSS-Tricks
This is the code for the “close” or “cross” icon that was downloaded from flaticon.com and built by pixel-perfect:.
Read more >
Tag Shapes Svg - Etsy
Check out our tag shapes svg selection for the very best in unique or custom, handmade pieces from our papercraft shops.
Read more >
5 Most Common Problems Faced by SVG Users - Vecta.io
1. Missing fonts · A. Wrongly declared font name · B. You're using <img> or background image to embed your SVG · C....
Read more >
Do you need closing tags with SVGs? - Quora
SVG is based on XML (and a DTD), so all tags need to be closed ! It can reside within a page written...
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