Why don't you wrap the use element in a <g id="____">, search for the "g" and then look for the <use> inside the "g"... Works fine for me...
Peter Kalev Senior Developer, SWF, LLC -----Original Message----- From: Sean [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 08, 2006 11:21 AM To: svg-developers@yahoogroups.com Subject: Re: [svg-developers] Re: use tag and unique IDs I should say navigate the use element. I realize that it is read only, but I can't figure out how to do that. Thanks. Sean wrote: >Does any one have examples of using SVGUseElement & SVGElementInstance? >Thanks. > >Sean > >Sean wrote: > > > >>Hi Alastair, >> >>Thanks for the input. I figured as much with the id, but >>getElementByName didn't work either. I was hoping that something would >>work. I tried the childNodes and firstChild, but nothing works. >>objet.childNodes.length returns 0, which appears to mean that the child >>nodes under the use tag don't get recognized, rendering the approaches >>below useless, no pun intended. My failure to get the use tags to work >>would mean the difference between using 35,000 tags and 210,000 tags. I >>have quite the incentive to make it work. Thanks. >> >>var objet=evt.target; >>alert(objet.childNodes.length); >> >>var child = objet.firstChild; >>i=0; >>while(child != null){ >> childSibling = child.nextSibling; >> alert(child.nodeType); >> child = childSibling; >>} >> >>Sean >> >>Alastair Fettes wrote: >> >> >> >> >> >>>You've made a fundamental mistake. >>> >>>1. The idea behind a defs section is to resuse (have multiple copies) >>>of an definition. >>>2. The idea of an ID attribute is to only have one attribute with a >>>specific value document wide (see xs:ID type - >>><http://www.w3.org/TR/xmlschema-2/#ID>). >>> >>>So therefore you have a fundamental mistake. The defs section and the >>>id invalidate each other. >>> >>>The only thing you could (possibly) do would be to getElementById( >>>"useFrame2" ).childNodes.foo.bar to get the tspan. Maybe, i don't >>>guarantee it. >>> >>>Alastair >>> >>>--- In svg-developers@yahoogroups.com, Sean <[EMAIL PROTECTED]> wrote: >>> >>> >>> >>> >>> >>> >>>>I would like to use the use tags to save much text size as below. >>>>Problem is grabbing and editing data with onclick events. The id >>>> >>>> >>>> >>>> >>>> >>>> >>>for my >>> >>> >>> >>> >>> >>> >>>>tspan would always be the same, but they would be used in different use >>>>tags with unique IDs. Is there a way to isolate say the tspan1 under >>>>useFrame2? >>>> >>>>SVG >>>><defs> >>>><g id="textFrame" cat="textBox"> >>>> <text cat="textBox" font-size="14" font="sans-serif" ><tspan >>>>id="tspan1" cat="textBox">Text</tspan></text> >>>> <text><tspan visibility="hidden" id="tspan2"></tspan></text> >>>></g> >>>></defs> >>>><use id="useFrame" onclick="edit2(evt);" xlink:href="#textFrame" >>>>transform="translate(10,25)"/> >>>><use id="useFrame2" onclick="edit2(evt);" xlink:href="#textFrame" >>>>transform="translate(10,50)"/> >>>> >>>>JS >>>>function edit2(evt){ >>>> var objet=evt.target; >>>> var tspan1 = objet.getElementById("tspan1"); //Doesn't work >>>>} >>>> >>>>Thanks! >>>> >>>>Sean >>>> >>>>-- >>>>"I'd rather have a bottle in front of me, than a frontal lobotomy." >>>>-- Tom Waits >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> >>>----- >>>To unsubscribe send a message to: [EMAIL PROTECTED] >>>-or- >>>visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" >>>---- >>>Yahoo! Groups Links >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> >> >> >> > > > -- "I'd rather have a bottle in front of me, than a frontal lobotomy." -- Tom Waits ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/