mbostock / svjimmy

A bookmarklet to download SVG as PNG.

Home Page:https://mbostock.github.io/svjimmy/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support nested SVG elements.

mbostock opened this issue · comments

We should only render the outermost SVG.

These might well be edge cases, but there are legitimate reasons for nesting SVGs, where all the SVGs play a role (but the inner SVGs have the content):

Not sure what heuristics could be used, though.

Are you suggesting that there should be different behavior than rendering only the outermost SVG element, and if so, what behavior are you suggesting?

Rendering the outermost SVG element includes whatever content is in the contained SVG elements. There’s still the issue of dropping the external styles, but on the Josquin example, you get five images.

The “viewer”:
untitled

The “navigator” (blank because it uses external styles):
untitled-6

And three icons comprising the “legend”:
untitled-8
untitled-9
untitled-10