xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Hardy <vincent.ha...@sun.com>
Subject Re: Why does Squiggle complain about javascript?
Date Thu, 10 Jul 2003 13:26:16 GMT
Hi Don,

Actually, many thanks for your email and report, you saved our day! You 
spotted a regression that our regression test environment should have 
caught (I am going to work on why it did not). This is especially 
timely: we are busy working on the 1.5 final release.

Thomas and I discussed this issue and Thomas has a fix for it that he'll 
commit later today. The window object was available but recent changes 
made it unavailable. As you mentioned, 'window' is a commonly available 
global variable.

In Batik, we have the window object (which has the alert/setTimeout 
methods etc...) and the document object available as global objects by 
default.

Cheers,
Vincent.

D. DeCoudras wrote:

> Vincent,
>
> Thank you for further clarifying the relationship between ECMAScript 
> and Javascript / Jscript. In the Batik context, the following code 
> excerpt is embedded in one of my SVG files as follows:
>
>         <script  type="text/ecmascript">
>             <![CDATA[
>             var svgns = "http://www.w3.org/2000/svg";
>             function ToggleDisplay(evt)
>             {
>                 if ( window.svgDocument == null )
>                    svgDocument = evt.target.ownerDocument;
>                 triadObjects = svgDocument.getElementById("Triangles");
>
> In the above code, the ToggleDisplay(evt) function is associated with 
> an onclick event defined elsewhere in the SVG document. When the user 
> using Batik clicks on a graphical representation of the object that 
> triggers this function, Batik yields an SVG Error stating, "window is 
> not defined". With apologies, I probably shouldn't have attributed 
> this error with my own personal schema as "freaking out"  ... as 
> others may not agree with my schema.
>
> If I take the exact same code aforementioned and thus the exact same 
> SVG document and click on the exact same user interface graphical 
> representation that triggers the event with an onclick -- in Internet 
> Explorer 5.x running on Mac OS X 10.2.6 with the Adobe SVG Viewer 
> plug-in plugged in to IE 5.x, I do not receive any errors and the 
> above ECMAscript executes completely (note: I wouldn't expect to see 
> any errors being reported anyway since IE and the Adobe SVG Viewer do 
> not have an error reporting mechanism to my knowledge).
>
> If I remove the entire if() statement containing the reference to the 
> global, "window" and rearrange as in:
>
>
>     svgDocument = evt.target.ownerDocument;
>
> then the user interface experience works perfectly in Batik.
>
> I am new to javascript and certainly ECMAScript, so maybe javascript 
> is much more forgiving with respect to global variables and how they 
> are referenced and/or declared?
>
> Best regards,
>
> -Don
>
>> From: Vincent Hardy <vincent.hardy@sun.com>
>> Reply-To: "Batik Users" <batik-users@xml.apache.org>
>> To: Batik Users <batik-users@xml.apache.org>
>> Subject: Re: Why does Squiggle complain about javascript?
>> Date: Thu, 10 Jul 2003 14:24:41 +0200
>>
>> Hi Don,
>>
>> ECMAScript is the standardized language that, as far as I know, tried 
>> to make JScript and JavaScript into interoperable languages.
>>
>> I do not know enough about the language differences to give a 
>> meaningful answer on how they differ. However, and this is true for 
>> ECMAScript as well, there are libraries or global objects / functions 
>> which are not part of the standard and that may (or not) be available 
>> depending on the implementation.
>>
>> In the Batik context, I am not sure what you mean when you say Batik 
>> freaks out on 'window'. This is a global object we support in 
>> ECMAScript and there are samples in samples/tests/spec/scripting that 
>> use it. Could you send an example of what you see go wrong?
>>
>> Regards,
>> Vincent.
>>
>> D. DeCoudras wrote:
>>
>>> Thanks Vincent. I also found out from experimentation that removing 
>>> the type attribute altogether also works with Batik (I.e., <script> 
>>> [CDATA ...). Are there any good references on the differences 
>>> between ecmascript and javascript? For instance, in javascript I can 
>>> refer to the global "window" but Batik freaks out if it sees the 
>>> same javascript reference, so I had to remove it. I hope its not 
>>> Pandora's box with respect to the differences between ecmascript and 
>>> javascript. After all, our collective interest in the Batik 
>>> community is to get progress SVG and get it in the hands of many.
>>>
>>> Best regards,
>>>
>>> -Don
>>>
>>>> From: Vincent Hardy <vincent.hardy@sun.com>
>>>> Reply-To: "Batik Users" <batik-users@xml.apache.org>
>>>> To: Batik Users <batik-users@xml.apache.org>
>>>> Subject: Re: Why does Squiggle complain about javascript?
>>>> Date: Thu, 10 Jul 2003 10:12:59 +0200
>>>>
>>>> Hello,
>>>>
>>>> The type should be "text/ecmascript" not "text/javascript".
>>>>
>>>> There are multiple examples of scripting using ECMAScript in the 
>>>> samples/tests/spec/scripting directory.
>>>>
>>>> Regards,
>>>> Vincent.
>>>
>>>
>>>
>>> _________________________________________________________________
>>> Add photos to your messages with MSN 8. Get 2 months FREE*.  
>>> http://join.msn.com/?page=features/featuredemail
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>> For additional commands, e-mail: batik-users-help@xml.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>> For additional commands, e-mail: batik-users-help@xml.apache.org
>>
>
> _________________________________________________________________
> Tired of spam? Get advanced junk mail protection with MSN 8. 
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message