Svg icon not working in IE9-10

Work for the first time on svg. I have the following svg definition for the arrow-like path

<defs> <marker id="start" refX="1" refY="5" markerUnits="userSpaceOnUse" markerWidth="17" markerHeight="11" orient="auto"> <path id="conditional" d="M 0 6 L 8 1 L 15 5 L 8 9 L 1 5" fill="white" stroke="black" stroke-width="1" /> <path id="default" d="M 5 0 L 11 10" fill="white" stroke="black" stroke-width="1" /> </marker> <marker id="end" refX="15" refY="6" markerUnits="userSpaceOnUse" markerWidth="15" markerHeight="12" orient="auto"> <path id="arrowhead" d="M 0 1 L 15 6 L 0 11z" fill="black" stroke="black" stroke-linejoin="round" stroke-width="2" /> </marker> </defs> <g id="edge"> <path id="bg_frame" d="M10 50 L210 50" stroke="black" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" marker-start="url(#start)" marker-end="url(#end)" /> <text id="text_name" x="0" y="0" oryx:edgePosition="startTop"/> </g> 

But it does not show the arrow at the end of the path in IE 9 or IE 10

Is the "triangle" supported in IE or is there a problem in the code?

An example here http://www.w3.org/TR/SVG11/images/painting/marker.svg does not work in IE either.

Help Please, this is the only thing that made my workflow editor.

Communication result

enter image description here

The result of my code in FF:

enter image description here

And the result of the code in IE (no arrow, no square at the end of the arrow):

enter image description here

+8
internet-explorer svg
source share
7 answers

The problem has already been reported by Microsoft, as xdhmoore wrote in his answer: https://connect.microsoft.com/IE/feedback/details/801938/dynamically-updated-svg-path-with-a-marker-end-does-not- update

There is a fiddle showing the problem: http://jsfiddle.net/EEYZZ/

  //if (isIE10 || isIE11) { var parent = p1.parentNode; parent.removeChild(p1); parent.appendChild(p1); //} 

My workaround is to manuelly remove the node from the DOM and add it again, this will update the node as necessary ... Don’t talk about performance, etc., but I think there is currently no better way to do this . ( http://jsfiddle.net/kaljak/5zTv9/3/ )

+7
source share

I ran into the same problem and it caused me some headache - I really don't understand why Microsoft is not fixing it. I decided to replace the markers with custom paths that have a good side effect that you can, for example. change the fill or color at runtime using JavaScript.

I create my svg using d3, the edge has an edge-path class, and the tip has an edge-tip class. Both paths are svg: g child elements. The edge itself is a spline, so to rotate the tip, I take the slope of the last 10 pixels. This is pretty much the code that is used to update the arrow, works in IE9-11:

 edge.select('path.edge-tip') // the shape of the tip .attr('d', 'M0,0L10,5L0,10Z') // move the tip to the end of the edge and rotate. .attr('transform', function(d) { var parent = d3.select(this).node().parentNode, path = d3.select(parent).select('path.edge-path').node(), pathLength = path.getTotalLength(), point1 = path.getPointAtLength(Math.max(0, pathLength - 10)), point2 = path.getPointAtLength(pathLength), vect = { x: point2.x - point1.x, y: point2.y - point1.y } l1 = vect.x * vect.x + vect.y * vect.y; l1 = Math.sqrt(l1); var angle = Math.acos(vect.x / l1); angle = 360 * (angle / (2*Math.PI)); if (vect.y < 0) { angle = 360 - angle; } return 'translate(' + point1.x + ',' + (point1.y - 5) + ') rotate (' + angle +' 0 5)'; }); 

Maybe this helps someone :)

+2
source share

One issue in IE seems to be that marker inherits the properties stroke , stroke-width and fill (contrary to standards).

However, this can be circumvented by setting the properties of the stroke explicitly.

Consider the problem with

http://www.w3.org/TR/SVG11/images/painting/marker.svg

By setting stroke="none" and fill="black" , rendering seems fine:

https://codepen.io/anon/pen/qmYzGE

Note. I tested this only in IE11. I assume that it will work, at least in IE10. Any information on this is greatly appreciated.

+1
source share

It looked great for IE10 for me (diamond shape on the left and triangle on the right).

However, there are some known issues with markers in IE. For example, IE does not support markerUnits = "strokeWidth".

0
source share

Stacking another group around an element and defining markers within that group work in MS Edge and others.

  <g id="maszlinie" style="marker-start: url(#pf2); marker-end: url(#pf)"> <g id="bline" transform="translate(0,-20)"> <line class="masz" y2="365" y1="365" x2="415" x1="15"> </g> </g> 
0
source share

I couldn't get markers to work in IE11, but in Edge they work. The trick for embedded SVGs is to use xml:id for markers, not just id .

Edit: virtually anything:id works. I do not know why.

Edit 2: Ugh. This destroys SVG in Chrome. You can duplicate the identifier: id="foo" edge_sucks:id="foo" .

Edit 3: Hmm scratch, which seems to work in Edge anyway. I don’t know what is going on.

0
source share

All Articles