Re: adding image namespace in svg through JS still doesn't show me the picture

Robert Longson <[email protected]> Wed, 3 Aug 2011 03:44:21 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.svg
Organization http://groups.google.com
Message-ID <8e821307-a7c8-44e8-81e6-27fc60b2b560@j15g2000yqf.googlegroups.com>
On Aug 1, 3:08 am, Tamer Higazi <[email protected]> wrote:
>
> this.svg = document.getElementsByTagNameNS('http://www.w3.org/2000/
> svg','svg');
> var bild = document.createElementNS('http://www.w3.org/2000/
> svg','image');
> var BildURL = this.image[0][0].getAttribute('xlink:href');

you should probably use getAttributeNS instead.

> var imgX = new Image();
> imgX.src = BildURL;
>
> bild.setAttribute("x","60");
> bild.setAttribute("y","40");
> bild.setAttribute("width",imgX.width);
> bild.setAttribute("height",imgX.height);
> bild.setAttribute("id","image12976");
> bild.setAttribute("xlink:href",BildURL);

setAttributeNS

Is there a complete example somewhere to examine? I'm only guessing
that these changes may improve things at the moment.

Best regards

Robert.