Login Register

problem with dojo.addOnLoad on IE7

Hello

I tried do call dojo.addOnLoad (dojo1.0) in a custom object file, to create a single instance of the object :

if(!dojo._hasResource["webshop.utils.Portability"]){ 
dojo._hasResource["webshop.utils.Portability"] = true;
dojo.provide("webshop.utils.Portability");


dojo.declare("webshop.utils.Portability",null , {
    getNodeContent : function (node){
        .....
  }

});

function init(){
alert('init function running')
portability=new webshop.utils.Portability();
}
dojo.addOnLoad(init);

}

;

It works on FF but not on IE 7....

If anyone has an idea....
Thankx

(http://dojotoolkit.org/forum/dojo-core-dojo-0-9/dojo-core-support/ie6-7-...
http://trac.dojotoolkit.org/ticket/3528)

Two things: 1) This does

Two things: 1) This does not cause an error (at least not yet until you do a custom build), but *do not* include these lines in your source:
if(!dojo._hasResource["webshop.utils.Portability"]){
dojo._hasResource["webshop.utils.Portability"] = true;

Those are added by the build process, and if you manually add them, when you do a custom build, then it means you will get the lines twice, which will cause some errors.

2) Normally if it works in FF but not in IE, it is a trailing comma issue. Make sure that there is no stray comma after the object property definitions or at the end of explicitly declared array members.