[crossposted as this mail contains a bug description/"fix"]

> , but it still seems rather odd

Indeed. This error doesn't occur in examples/dynapi.api.delete.htm
for example...

I couldn't really track down this bug but it seems to be relevant in
which context deleteFromParent() is called.
When the context is dynamic Netscape 4 seems to have a problem with the
delete statement in dynapi.js l.78.
In Javascript you are not allowed to delete "this" and deleteChild is
called with "this" as the argument.
As it seems rather odd to me to delete an argument I would propose to
replace the relevant section in DynObject.prototype.deleteChild:

    this.children[i] = this.children[l-1];
    this.children[l-1] = null;
    this.children.length--;
    c.del()
    delete c;

with:
    c.del()
    delete this.children[i];
    this.children[i] = this.children[l-1];
    this.children[l-1] = null;
    this.children.length--;

This eliminates the Netscape error but it is not tested for memory
leaks in Dynapi.

By the way, have you noticed the difference in event handling between
Netscape/Mozilla and IE5 in your sample code?

Stephan

>> It would be interesting to know what you are actually "fiddling
>> around", e.g. a code snippet could help understanding that issue.
> Here's a distilled version of the problem page.  Sorry it's a bit more than a 
> "snippet"; I wouldn't know what to send & what not to.
> 
> <html> <head> <title>onmouseover/onmouseout problem</title>
> <script language="javascript" src="../src/dynapi.js"></script>
>  
> <script language="javascript">
> <!--
> DynAPI.setLibraryPath("../src/lib/");
> DynAPI.include("dynapi.api.*");
> DynAPI.include("dynapi.event.*");
>  
> function MakeLayer() {
>     var newLayer = new DynLayer(null,200,110,100,50,"#c0c0c0");
>     DynAPI.document.addChild(newLayer);
> }
>  
> function RemoveLayer() {
>     var index = DynAPI.document.children.length - 1;
>     DynAPI.document.children[index].deleteFromParent();
> }
>  
> DynAPI.onLoad = function() {
>   myLayer = new DynLayer(null, 100, 100, 100, 100, '#c0c0c0');
>  
>   // create EventListener object
>   myEventListener = new EventListener(myLayer);
>  
>   // define onmouseover event handler for myEventListener object
>   myEventListener.onmouseover = function(e) {
>     MakeLayer();
>   }
>  
>   // define onmouseout event handler for myEventListener object
>   myEventListener.onmouseout = function(e) {
>     RemoveLayer();
>   }
>  
>   myLayer.addEventListener(myEventListener);
>   DynAPI.document.addChild(myLayer);
>  
> }
>  
// -->>
> </script>
> </head>
> <body bgcolor=white> <h1>onmouseover/onmouseout Problem</h1>
> </body> </html>


_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev

Reply via email to