Skip to content Skip to sidebar Skip to footer

Adding Image Namespace In Svg Through Js Still Doesn't Show Me The Picture

after working out getting the parameter through a scaled version of a picture, I am trying through Javascript adding the picture with the original size parameter in SVG. Firebug sh

Solution 1:

You should never use getAttribute/setAttribute on attributes that have prefixes, see DOM 3 Core for more details on why.

It will work just fine if you use

getAttributeNS('http://www.w3.org/1999/xlink', 'href')

and

setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', your_url_here).

Solution 2:

Try creating the image with null namespace:

var bild = document.createElementNS(null, 'image');

Post a Comment for "Adding Image Namespace In Svg Through Js Still Doesn't Show Me The Picture"