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]

Reply via email to