From 98be8d5f81dc2ead3172d91500ea31fabf04d913 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Thu, 18 Feb 2010 17:41:07 +0000 Subject: [PATCH] Fix Issue 489: The href attribute on image elements was being created without a prefix. setAttributeNS(nsuri, name, value) takes a qname, not a localname as its 2nd argument. (This is not to be confused with getAttributeNS(nsuri, name), which takes a localname as its 2nd argument.) git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1410 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 3cba945e..a98cdc34 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -1380,7 +1380,7 @@ function BatchCommand(text) { // TODO: we simply check if the first character is a #, is this bullet-proof? if (href[0] != "#") { // remove the attribute (but keep the element) - node.setAttributeNS(xlinkns, "href", ""); + node.setAttributeNS(xlinkns, "xlink:href", ""); node.removeAttributeNS(xlinkns, "href"); } } @@ -2951,7 +2951,7 @@ function BatchCommand(text) { "style": "pointer-events:inherit" } }); - newImage.setAttributeNS(xlinkns, "href", last_good_img_url); + newImage.setAttributeNS(xlinkns, "xlink:href", last_good_img_url); preventClickDefault(newImage); break; case "square": @@ -5600,7 +5600,7 @@ function BatchCommand(text) { if(m) { var url = decodeURIComponent(m[1]); $(new Image()).load(function() { - image.setAttributeNS(xlinkns,'href',url); + image.setAttributeNS(xlinkns,'xlink:href',url); }).attr('src',url); } } @@ -6888,7 +6888,7 @@ function BatchCommand(text) { // } } else if (attr == "#href") { - elem.setAttributeNS(xlinkns, "href", newValue); + elem.setAttributeNS(xlinkns, "xlink:href", newValue); } else elem.setAttribute(attr, newValue); if (i==0) @@ -7659,7 +7659,7 @@ function BatchCommand(text) { 'style':'pointer-events:none' }); } - bg_img.setAttributeNS(xlinkns, "href", url); + bg_img.setAttributeNS(xlinkns, "xlink:href", url); bg.appendChild(bg_img); } else if(bg_img) { bg_img.parentNode.removeChild(bg_img);