2009/1/29 Dan Slater <[email protected]>: > Hi, Age, > > Never mind the filter. This will get you where you want to go...supply your > click target, and modify it to break at the use element - you'll see you can > access the id: > > public static SVGElement returnNextDOMEltUp(SVGElement svgElt) { > Node n = svgElt; > String name = "start"; > > while (!name.equals("g")) { > if (n instanceof SVGOMCSSImportedElementRoot){ > n=((SVGOMCSSImportedElementRoot)n).getCSSParentElement(); > } else { > n = n.getParentNode(); > if (n instanceof SVGOMDocument) return null; > } > if (n instanceof SVGElement) { > showIdAndNodeName(n); > } > name = n.getNodeName(); > } > if (n instanceof SVGElement) { > svgElt = (SVGElement)n; > } else svgElt = null; > return svgElt; > } >
Many thanks for the help Dan, with some minor alterations it works like a charm. I still don't completely understand why it has to be done this way but it works. One alteration worth mentioning is changing the 'if (n instanceof SVGOMDocument)' statement to return the original input element 'svgElt' instead of null. This will deal with referenced elements not located in a 'defs' element/section. Age --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
