Mark, The function 'setColour' is one that I have declared in the script element of the nested svg, and the spellings of caller and callee are both correct. I have checked the SVG 1.1 spec and there does not seem to be any restrictions on placement of script elements, so I am assuming that Batik should not be ignoring script elements in nested SVGs.
If you, or anyone else, agrees with me that this behaviour is incorrect, then I will raise a bug and attach my test case. Regards Philip Fennell ________________________________ From: Mark A Fortner [mailto:[EMAIL PROTECTED] Sent: 20 July 2006 04:15 To: [email protected] Subject: Re: Scripts within nested SVGs being ignored. My guess is that the spelling of "setColour" isn't recognized. Try the American spelling and see if that works. Mark "Fennell, Philip" <[EMAIL PROTECTED]> wrote: Now that I have js.jar on my classpath I've got my ecmascript running happily, but... In the application I'm working on a 'background/canvas' SVG document is loaded into JSVGCanvas when the application launches. Then I select and open another SVG document who's documentElement is imported into the 'canvas' document and inserted into the 'canvas'. The inner SVG has a script element with a function that is called from an onclick event in the inner SVG. When I click on the primitive in the view I get the error listed below. If I move the script element up into the top level (parent) SVG, the 'canvas', then the script runs happily. Is there a reason why Batik ignores script declarations in descendant svg elements? Stacktrace: =========== org.mozilla.javascript.EcmaError: ReferenceError: "setColour" is not defined. (Event attribute null:-1 onclick#1) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3 226) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3 216) at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:32 89) at org.mozilla.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntim e.java:1891) at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:93) at org.mozilla.javascript.gen.c1._c0(Event attribute null:-1 onclick:1) at org.mozilla.javascript.gen.c1.call(Event attribute null:-1 onclick) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755) at org.mozilla.javascript.gen.c1.call(Event attribute null:-1 onclick) at org.mozilla.javascript.gen.c1.exec(Event attribute null:-1 onclick) at org.mozilla.javascript.Context.evaluateReader(Context.java:1163) at org.apache.batik.script.rhino.RhinoInterpreter.evaluate(Unknown Source) at org.apache.batik.bridge.ScriptingEnvironment.runEventHandler(Unknown Source) at org.apache.batik.bridge.ScriptingEnvironment$ScriptingEventListener.hand leEvent(Unknown Source) at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source) at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source) at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source) at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source) at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(U nknown Source) at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(U nknown Source) at org.apache.batik.bridge.BridgeEventSupport$Listener.mouseClicked(Unknown Source) at org.apache.batik.gvt.event.AbstractAWTEventDispatcher.processMouseEvent( Unknown Source) at org.apache.batik.gvt.event.AbstractAWTEventDispatcher.dispatchMouseEvent (Unknown Source) at org.apache.batik.gvt.event.AbstractAWTEventDispatcher.dispatchEvent(Unkn own Source) at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown Source) at org.apache.batik.gvt.event.AbstractAWTEventDispatcher.mouseClicked(Unkno wn Source) at org.apache.batik.swing.svg.AbstractJSVGComponent$SVGListener$12.run(Unkn own Source) at org.apache.batik.util.RunnableQueue.run(Unknown Source) at java.lang.Thread.run(Thread.java:595) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ________________________________ Do you Yahoo!? Next-gen email? Have it all with the all-new Yahoo! Mail Beta. <http://us.rd.yahoo.com/evt=42241/*http://advision.webevents.yahoo.com/h andraisers> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
