A problem with dojo.require and Safari

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

A problem with dojo.require and Safari

Jeremy Quinn
Dear All

I am looking into switching the standard Ajax Library for Apache  
Cocoon to Dojo.
Ajax is being used more and more in the Cocoon Forms block, which is  
currently made up from a mixture of home grown and 3rd party  
javascript libraries.

The first thing I am trying to get done, is the dynamic loading of  
JavaScript libraries using dojo.require. We want to be able to  
dynamically load Dojo libs, Cocoon libs and 3rd party libs.

The Cocoon libs will be re-written to use the typical Dojo style and  
a Cocoon namespace but the 3rd party libs will not and are mostly  
written in the traditional form:
        function functionname(params) { // function body }

We realised that the functions in a file loaded via dojo.require
("the.name.space") do not need to be written in the same namespace  
themselves, but that all that should be needed to get the 3rd party  
libs loading was to add the relevant dojo.provide("the.name.space")  
to the beginning of them, then require them as needed.

While testing this, I found a problem with Safari.

If functions are declared like this and loaded via dojo.require then  
they work fine in FireFox, but not Safari :

        function functionname() {
                dojo.debug("Test says hello!");
        }

Safari gives this error :

        TypeError - Object  (result of expression functionname) does not  
allow calls.

The 3 other ways of declaring functions that I have tried, all seem  
to work in Safari under these circumstances.

I could not find anything similar in the Dojo bug reporter.

Is this a known problem, is there a fix?

Thanks for any suggestions.

regards Jeremy

_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest

smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: A problem with dojo.require and Safari

Alex Russell
Hi Jeremy,

On Wednesday 07 December 2005 10:26 am, Jeremy Quinn wrote:
> Dear All
>
> I am looking into switching the standard Ajax Library for Apache
> Cocoon to Dojo.

Cool!

> Ajax is being used more and more in the Cocoon Forms block, which is
> currently made up from a mixture of home grown and 3rd party
> javascript libraries.
>
> The first thing I am trying to get done, is the dynamic loading of
> JavaScript libraries using dojo.require. We want to be able to
> dynamically load Dojo libs, Cocoon libs and 3rd party libs.
>
> The Cocoon libs will be re-written to use the typical Dojo style and
> a Cocoon namespace but the 3rd party libs will not and are mostly
> written in the traditional form:
> function functionname(params) { // function body }

Shouldn't be a problem.

> We realised that the functions in a file loaded via dojo.require
> ("the.name.space") do not need to be written in the same namespace
> themselves, but that all that should be needed to get the 3rd party
> libs loading was to add the relevant dojo.provide("the.name.space")
> to the beginning of them, then require them as needed.

Correct.

> While testing this, I found a problem with Safari.
>
> If functions are declared like this and loaded via dojo.require then
> they work fine in FireFox, but not Safari :
>
> function functionname() {
> dojo.debug("Test says hello!");
> }
>
> Safari gives this error :
>
> TypeError - Object  (result of expression functionname) does not
> allow calls.

This looks like a Safari JS engine bug. We might be able to coerce some
of it using a with(window){...} block, but that seems grotty.

Can you please file a bug on this at http://dojotoolkit.org/trac/ and
mark it for 0.3release?

Thanks

> The 3 other ways of declaring functions that I have tried, all seem
> to work in Safari under these circumstances.
>
> I could not find anything similar in the Dojo bug reporter.
>
> Is this a known problem, is there a fix?
>
> Thanks for any suggestions.
>
> regards Jeremy
> _______________________________________________
> Dojo-interest mailing list
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest

--
Alex Russell
[hidden email] BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723
[hidden email]  F687 1964 1EF6 453E 9BD0 5148 A15D 1D43 AB92 9A46
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: A problem with dojo.require and Safari

kredytkons
This post has NOT been accepted by the mailing list yet.
In reply to this post by Jeremy Quinn
Thank you for heads up. I will make sure to do it, Regards kalkulator kredytowy kredyt konsolidacyjny oc kalkulator ubezpieczenie oc ubezpieczenie oc