jhamlet / svg-react-loader

Webpack SVG to React Component Loader
MIT License
559 stars 82 forks source link

Support simple text tags #5

Closed jeron-diovis closed 8 years ago

jeron-diovis commented 8 years ago

Hi. I'm using your plugin (very useful one, need to say), and found a problem.

I managed to break everything down with this simple structure:

<svg>
    <title>Text</title>
</svg>

It falls into recursion here, endlessly invoking sanitize for key 0 of the same string.

I added this at the very beginning of sanitize function and it helped:

if (typeof xmlNode === "string") {
    return xmlNode;
}

Don't know whether it's correct.

Please fix this.

jhamlet commented 8 years ago

@jeron-diovis Thanks for the report, and the useful investigation.

I'll dig in deeper as soon as I can.

jhamlet commented 8 years ago

I've made an attempt at getting it to work.

Can you try it on your project to see if it handles your current use-cases?

You can point your svg-react-loader dependency to git+https://github.com/jhamlet/svg-react-loader#33445b3dd9e4de57128a7c6860df5104d99b7d9c to get the unpublished changes.

;-j

jeron-diovis commented 8 years ago

Now it works fine for me.

jhamlet commented 8 years ago

Cool. Merging to master.