What steps will reproduce the problem?
1. Whitelist your custom element/attribute combination in sanitize.js
2. Add an attribute to an element via a plugin, e.g.
element.setAttributeNS('http://www.w3.org/1999/xlink', 'href', value);
3. Save the image.
What is the expected output?
<rect xlink:href="somelink"/>
What do you see instead?
<rect href="somelink"/>
In what browser did you experience this problem? (ALL, Firefox, Opera, etc)
Firefox 11.0, Chrome 17.0
In what version of SVG-edit does the problem occur? (Latest trunk, 2.5.1,
etc)
Latest trunk (r2077)
Please provide any additional information below.
The following patch fixes the problem, at least for me:
--- editor/svgcanvas.js (revision 2078)
+++ editor/svgcanvas.js (working copy)
@@ -5228,7 +5228,11 @@
// map various namespaces to our fixed namespace prefixes
// (the default xmlns attribute itself does not get a prefix)
if(!attr.namespaceURI || attr.namespaceURI == svgns || nsMap[attr.namespaceURI]) {
- out.push(attr.nodeName); out.push("=\"");
+ if (nsMap[attr.namespaceURI]) {
+ out.push (nsMap[attr.namespaceURI]);
+ out.push (':');
+ }
+ out.push(attr.localName); out.push("=\"");
out.push(attrVal); out.push("\"");
}
}
Original issue reported on code.google.com by mor...@wissenba.ch on 5 Apr 2012 at 1:27
Original issue reported on code.google.com by
mor...@wissenba.ch
on 5 Apr 2012 at 1:27