Skip to content

Some SVG attributes aren't correctly handled, for example viewBox#52

Merged
remarkablemark merged 4 commits intoremarkablemark:masterfrom
phawxby:master
May 13, 2018
Merged

Some SVG attributes aren't correctly handled, for example viewBox#52
remarkablemark merged 4 commits intoremarkablemark:masterfrom
phawxby:master

Conversation

@phawxby
Copy link
Copy Markdown
Contributor

@phawxby phawxby commented May 11, 2018

The implementation assumes all attributes are lowercase, this isn't the case for SVGs. As a result when trying to map attributes to props the viewBox attribute breaks.

https://unpkg.com/react-dom@15.6.2/lib/SVGDOMPropertyConfig.js

@phawxby phawxby changed the title SVG attributes aren't correctly handled Som SVG attributes aren't correctly handled, for example viewBox May 11, 2018
@coveralls
Copy link
Copy Markdown

coveralls commented May 11, 2018

Coverage Status

Coverage remained the same at 99.206% when pulling 6ffb148 on phawxby:master into 17db9f3 on remarkablemark:master.

@phawxby phawxby changed the title Som SVG attributes aren't correctly handled, for example viewBox Some SVG attributes aren't correctly handled, for example viewBox May 11, 2018
@remarkablemark remarkablemark self-requested a review May 11, 2018 22:13
@remarkablemark remarkablemark self-assigned this May 11, 2018
@remarkablemark remarkablemark added the bug Something isn't working label May 11, 2018
"comment": "<!-- comment -->",
"doctype": "<!DOCTYPE html>"
"doctype": "<!DOCTYPE html>",
"svg": "<svg viewBox=\"0 0 512 512\" id=\"foo\">Inner</svg>"
Copy link
Copy Markdown
Owner

@remarkablemark remarkablemark May 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind moving this line under svg property?

{
    "html": {
        // ...
    },
    "svg": {
        "simple": "<svg viewBox=\"0 0 512 512\" id=\"foo\">Inner</svg>",
        // ...
    }
}

I should also rename this file to data.js but you don't have to do that in this PR

@phawxby
Copy link
Copy Markdown
Contributor Author

phawxby commented May 12, 2018

As requested. Thanks for the quick feedback on this.

@remarkablemark remarkablemark merged commit 0575023 into remarkablemark:master May 13, 2018
@remarkablemark
Copy link
Copy Markdown
Owner

remarkablemark commented May 13, 2018

Thanks for the PR @phawxby, I will make a release shortly.

Update: html-react-parser@0.4.6 is released and published to npm

d-lazarev pushed a commit to d-lazarev/html-react-parser that referenced this pull request Apr 5, 2019
Some SVG attributes aren't correctly handled, for example viewBox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants