Thomas,

Thanks for the tip.

I will enter a bug against this.




Regards

Philip Fennell 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 20 July 2006 10:45
To: [email protected]
Cc: [email protected]
Subject: RE: Scripts within nested SVGs being ignored.

Hi Philip,

"Fennell, Philip" <[EMAIL PROTECTED]> wrote on 07/20/2006 03:09:09
AM:

> 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.

   I don't think it has anything to do with nested SVG's.  I think we
ignore any script element added after initial document construction.

> If you, or anyone else, agrees with me that this behavior is 
> incorrect, then I will raise a bug and attach my test case.

   Please do.

   BTW you can probably fix this in your script by searching the 'too be
added' subtree for script elements (getElementsByTagNameNS) and simply
"eval"ing the text content of them (I say simply but the text content is
likely split across multiple text nodes).
Anyway it's a potential workaround if you need one.


> 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]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to