the problem is only that I'm not using any event.* on my test page
so it cannot be the problem..
maybe invokeEvent() should be rewritten like this, can't you put up
a test page so we can try speed and compatibility?

/martin


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of 
> Joachim Lundgren
> Sent: den 12 november 2001 15:42
> To: [EMAIL PROTECTED]
> Subject: RE: [Dynapi-Dev] Some Mac testing-reports..
> 
> 
> The "out of stack space"-error is probably due to the way 
> events are sent up the chain.
> As it is the invokeEvent method calls itself recursively, and 
> with many nested layers you run out of stack space fast. 
> Seems it happens sooner on the Mac.
> 
> This is the current implementation (listeners.js):
> 
> DynObject.prototype.invokeEvent=function(type,e,args) {
>         if (!e) e=new DynEvent(type,this);
>         if (this.hasEventListeners) for(var 
> i=0;i<this.eventListeners.length;i++) {
>                 e.target=this.eventListeners[i].target;
>                 this.eventListeners[i].handleEvent(type,e,args);
>         }
>         if(e.bubble && this.parent) {
>                 e.preBubbleCode();
>                 e.src = this.parent;
>                 this.parent.invokeEvent(type,e,args);   // <- 
> RECURSIVE!
>         }
> }
> 
> New code, skipping recursiveness (untested):
> 
> DynObject.prototype.invokeEvent=function(type,e,args) {
>         var o = this;
>         if (!e) e=new DynEvent(type,o);
>         while(o) {
>                 if(o.hasEventListeners) for(var 
> i=0;i<o.eventListeners.length;i++) {
>                         e.target=o.eventListeners[i].target;
>                         o.eventListeners[i].handleEvent(type,e,args);
>                 }
>                 if(e.bubble && o.parent) {
>                         e.preBubbleCode();
>                         o = o.parent;
>                         e.src = o;
>                 }
>                 else
>                         break;
>         }
> }
> 
> Should be a little faster too (perhaps noticable when deeply 
> nested). Of course, the error being discussed can be due to 
> something else.
> 
> /Lunna
> 
> 
> At 2001-11-12 14:53, martin str�m wrote:
> >hm it could be, but i just tested to do a couple of nested for-loops
> >that took some time to execute and put it to execute in onunload() 
> >and there wasn't any errors, it took time but ie just waited until 
> >everything were done and went on.
> >
> >i belive the DynAPI unloadHandler does too much for ie, 
> >maybe it is messing around with memory before fireing onunload 
> >and that�s why DynAPI.deleteAllChildren() works when it's not 
> >called from onunload. 
> >
> >i'll looking at this a bit further when i've got the time. 
> >
> >cheers
> >/martin
> >
> >> -----Original Message-----
> >> From: Michael Pemberton [mailto:[EMAIL PROTECTED]] 
> >> Sent: den 12 november 2001 13:12
> >> To: martin str�m
> >> Subject: Re: [Dynapi-Dev] Some Mac testing-reports..
> >> 
> >> 
> >> Is it possible that the unload function is taking too long to 
> >> execute and IE
> >> is trying to move on before the function has finished executing?
> >> 
> >> martin str�m wrote:
> >> 
> >> > IE5 has some problems when creating or deleting too many layers
> >> > (creating more than 62) and shows a js-error ("out of 
> stack space").
> >> > this happens as well when unloading the page and more 
> than 23 nested
> >> > layers was created. A strange thing I noticed was that if I 
> >> created 62
> >> > nested
> >> > layers (works OK) and manually call 
> >> DynAPI.deleteAllChildren()  (which
> >> > basically is what the unload-handler does, 
> DynAPI.onUnLoadCodes is
> >> > empty)
> >> > everything is working fine (no "out of stack space"-errors) 
> >> and the page
> >> > can
> >> > be unloaded without any errors.
> >> 
> >> --
> >> Michael Pemberton
> >> [EMAIL PROTECTED]
> >> ICQ: 12107010
> >> 
> >> 
> >> 
> >
> >
> >_______________________________________________
> >Dynapi-Dev mailing list
> >[EMAIL PROTECTED]
> >http://www.mail-archive.com/[email protected]/
> 
> 
> 
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
> http://www.mail-archive.com/[email protected]/
> 


_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[email protected]/

Reply via email to