4xx / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

Incorrect serialization of line markers in IE #1139

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open a new document in trunk SVG-Edit in IE 9.
2. Open the source editor.
3. Replace editor contents with this:
"
<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" 
xmlns:svg="http://www.w3.org/2000/svg">
 <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
 <defs>
  <marker se_type="leftarrow" orient="auto" markerHeight="5" markerWidth="5" markerUnits="strokeWidth" refY="50" refX="50" viewBox="0 0 100 100" id="se_marker_end_svg_1">
   <path d="m0,50l100,40l-30,-40l30,-40z" stroke-width="10" stroke="#000000" fill="#000000"/>
  </marker>
 </defs>
 <g>
  <title>Layer 1</title>
  <line y2="126.34" x2="311.21" y1="86.34" x1="134.21" stroke-width="5" stroke="#000000" marker-end="url(#se_marker_end_svg_1)" fill="none" id="svg_1"/>
 </g>
</svg>
"

4. Click "Apply Changes".
5. Reopen source editor.
6. Click "Apply Changes".

Expected output: Same results from step 6. as from step 4.
Observed output: A dialog box that states "There were parsing errors in your 
SVG source. Revert back to original SVG source?"

Reproduces in IE 9. Doesn't reproduce in Firefox 10

Reproduces in trunk r2524 and in 2.6

Other info: 
The issue appears to be in how IE handles url references in svg attributes. It 
inserts additional unescaped quotation marks around the reference string, which 
is all ready enclosed in the marker-end attribute string. This creates 
malformed XML. 
If you look at the instantiated html in the IE debugger the bad quotation marks 
are there.
If you save the svg using a text editor and view it in IE without SVG-Edit and 
look at the instantiated svg in the debugger the bad quotation marks are there.

Original issue reported on code.google.com by jesss...@gmail.com on 5 Sep 2013 at 8:43

GoogleCodeExporter commented 9 years ago
Can be fixed by revising the definition of svgedit.utilities.toXml thusly:

svgedit.utilities.toXml = function(str) {
    str=$('<p/>').text(str).html();
    str=str.replace(/\"/g,""");
    return str;
};

Original comment by jesss...@gmail.com on 6 Sep 2013 at 6:29