react icon indicating copy to clipboard operation
react copied to clipboard

SVG attributes getting ignored

Open tusharmath opened this issue 10 years ago • 7 comments

INPUT:

        <marker id="triangle"
    viewBox="0 0 10 10"
    refX={0} refY={5}
    markerUnits="strokeWidth"
    markerWidth="4" markerHeight="3"
    orient="auto">
    <path d="M 0 0 L 10 5 L 0 10 z"/>
</marker>

OUTPUT:

<marker id="triangle" viewBox="0 0 10 10" data-reactid=".0.1.1.0.0.1.2.1.0.1.0.0.1.0.0.1.0">
    <path d="M 0 0 L 10 5 L 0 10 z" data-reactid=".0.1.1.0.0.1.2.1.0.1.0.0.1.0.0.1.0.0"></path>
</marker>

Missing properties — refX, refY, markerUnits, orient

tusharmath avatar Jan 01 '16 05:01 tusharmath

Marker tag also misses markerWidth and markerHeight

rickbeerendonk avatar Jan 01 '16 18:01 rickbeerendonk

All attributes will be passed through to svg in the next release now that #5714 has landed. We won't be adding anymore individual attributes.

zpao avatar Jan 01 '16 19:01 zpao

So, until then? When is the next release?

On Sat, Jan 2, 2016, 12:35 AM Paul O’Shannessy [email protected] wrote:

Closed #5763 https://github.com/facebook/react/issues/5763.

— Reply to this email directly or view it on GitHub https://github.com/facebook/react/issues/5763#event-503832933.

Regards, Tushar Mathur. www.tusharm.com

tusharmath avatar Jan 02 '16 07:01 tusharmath

We'll ship 0.15 when it's ready. Rough estimate: probably not in January.

zpao avatar Jan 03 '16 00:01 zpao

But what is the alternative, I am drawing all my graphs in SVG using react. Is it simply impossible to do this right now ?

tusharmath avatar Jan 04 '16 07:01 tusharmath

As of now I am using dangerouslySetInnerHTML :( Which seems pretty dangerous to me.

tusharmath avatar Jan 04 '16 08:01 tusharmath

That or manually calling setAttribute on your svg node are the alternatives. The escape hatches are there but they are obviously unfortunate. The situation will be better soon.

zpao avatar Jan 04 '16 18:01 zpao