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

Support unquoted attributes #678

Closed
vzaidman opened this issue Mar 9, 2017 · 3 comments
Closed

Support unquoted attributes #678

vzaidman opened this issue Mar 9, 2017 · 3 comments
Assignees
Labels

Comments

@vzaidman
Copy link
Contributor

vzaidman commented Mar 9, 2017

if you have svgs with unquoted attributes such as:
xmlns="http://www.w3.org/2000/svg" width=20px height=20px

The error: Error in parsing SVG: Unquoted attribute value is emitted.

I've created a loader to temporary fix this in webpack:
https://www.npmjs.com/package/xml-fix-loader

{
  test: /\.svg$/,
  use: [
    { loader: 'file-loader' },
    { loader: 'svgo-loader' },
    { loader: 'xml-fix-loader' }
  ]
}
@rally25rs
Copy link

This error actually comes from the SAX parser that is parsing the SVG.

https://github.com/isaacs/sax-js/blob/5aee2163d55cff24b817bbf550bac44841f9df45/lib/sax.js#L1367

@SethFalco
Copy link
Member

Sax now provides a separate option so that we can allow unquoted attributes while in strict mode.

Reference:

However, I'm wondering if this really makes sense in the context of SVGO. Would you be able to share how you obtained this SVG with unquoted attributes? 🤔

For example, if it was handwritten, or created with tooling that no longer produced the erroneous output, then I'd be reluctant to enable the option. However, if it was created by a notable software/project that still has this behavior, then by all means I'd be happy to toggle it.

Just not sure if this makes sense in the context of SVGs.

@SethFalco
Copy link
Member

SethFalco commented Jun 5, 2024

I'll close this for now due to the lack of a response, but anyone is welcome to chime in or open a new issue on the topic when they're available to elaborate.

@SethFalco SethFalco closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants