Fix issue 1052: Properly parse the style attribute during sanitization

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2376 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Jeff Schiller
2013-02-13 15:04:58 +00:00
parent bc84fac91b
commit 936d9cc362
3 changed files with 55 additions and 4 deletions

View File

@@ -8,8 +8,9 @@
*/
// Dependencies:
// 1) browser.js
// 2) svgutils.js
// 1) jQuery
// 2) browser.js
// 3) svgutils.js
var svgedit = svgedit || {};
@@ -199,9 +200,11 @@ svgedit.sanitize.sanitizeSvg = function(node) {
p = props.length;
while(p--) {
var nv = props[p].split(":");
var attrname = $.trim(nv[0]);
var attrval = $.trim(nv[1]);
// now check that this attribute is supported
if (allowedAttrs.indexOf(nv[0]) >= 0) {
node.setAttribute(nv[0],nv[1]);
if (allowedAttrs.indexOf(attrname) >= 0) {
node.setAttribute(attrname, attrval);
}
}
node.removeAttribute('style');