Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline SVG self-closing tags #24

Open
pixeltherapy opened this issue Oct 27, 2014 · 3 comments
Open

Inline SVG self-closing tags #24

pixeltherapy opened this issue Oct 27, 2014 · 3 comments

Comments

@pixeltherapy
Copy link

In the same vein as #23 but with a common use scope, certain inline SVG elements are breaking due to changes in self-closing tags. In this case 'quotes:true' is optioned to prevent breaking of fill declarations, e.g. fill="url(#foo)".

Source:

<linearGradient id="foo">
  <stop offset="0" stop-color="#fff" />
  <stop offset="1" stop-color="#000" />
</linearGradient>

Output :

<lineargradient id="foo">
  <stop offset="0" stop-color="#FFF">
    <stop offset="1" stop-color="#000">
    </stop>
  </stop>
</lineargradient>

While this effects many SVG elements it does not seem to break primitives such as <rect /> and <circle />, no doubt these elements are a little more robust.

@Swaagie
Copy link
Owner

Swaagie commented Oct 27, 2014

Yes and no (concerning scope), this is also a known issue with htmlparser2. It has no full support for all SVG elements (yet). But since SVG is not user-defined it should be doable to create a parser that correctly parses all SVG elements. As you can see fb55/htmlparser2#79, I've ran into the issue myself as well. Like #23 this issue is more suited for htmlparser2/domparser.

However, i'll keep this one open. I haven't got the time myself to implement/extend the parser, but perhaps others can chip in?

@pixeltherapy
Copy link
Author

I agree, it is very doable and hardly earth-shattering as issues go.

Thanks for the link to htmlparser2, I'll have a look and see if I can contribute, because, y'know I'm all about that SVG. Will update here with any significant progress/updates.

@Swaagie
Copy link
Owner

Swaagie commented Oct 27, 2014

Sounds good, will keep an eye out and perhaps chip in some time as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants