Mozilla(Firefox) , Marker , Multiple SVGs

人盡茶涼 提交于 2019-12-02 18:15:31

问题


I've enbedded d3's force directed graph layout into extjs tabs so that each time a new tab gets added a new graph svg gets generated. No Problemo so far.

Now I intended to turn the graph into a directed one (by adding a marker and tell the lines to use it)

Each generated svg elements is following this pattern:

<svg width="100%" height="100%">

<defs><marker id="end-arrow" viewBox="0 -5 10 10" refX="6" markerWidth="3"     markerHeight="3" orient="auto"><path d="M0,-5L10,0L0,5" fill="#ccc"></path></marker>
</defs>

<g transform="translate(4,0) scale(1)"><line class="link" sig="30.84" style="stroke-width: 3;" x1="538" y1="347" x2="409" y2="467" marker-end="url(#end-arrow)"></line>
...
</g>
</svg>

With Crome everything works just fine. So I arrived at the concusion that the structur and the way I generate the svgs should be more or less correct.

But with Firefox the Markers will only show for the first svg. (the first tab) All other svgs won't show any Arrowheads.

"Inspect Elements" tells me the Markers are there and that the lines are refering to them.

And this is where I'm running out of Ideas where or what to look for. :(


回答1:


You have multiple non-distinct IDs within the same html or svg document. This is invalid, different UAs respond differently but as you're not allowed to do this, it doesn't really matter that they are inconsistent.



来源:https://stackoverflow.com/questions/18100266/mozillafirefox-marker-multiple-svgs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!