Re: Problem using a script to insert a <use> element

Boris Zbarsky <[email protected]>
Newsgroups gmane.comp.mozilla.devel.svg
Message-ID <[email protected]>
Tetra wrote:
> Is it possible to do this? The attached file successfully adds a <rect>
> element, but then fails to add a <use> element with the exact same method.

You're using:

   y.setAttribute('xlink:href', '#wtf')

That's wrong.  Welcome to XML namespaces!

You need to use setAttributeNS with the right namespace: 
"http://www.w3.org/1999/xlink".

For what it's worth, a tool like DOM Inspector would have told you this. 
  Firebug, sadly, doesn't seem to expose that information.

-Boris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.