As far as I can see the
delete c
only deletes the reference to a dynlayer, the real
work is being done by
c.del()
which calls
this.specificRemove();
this is only being overwritten in dynapi.js, the
function is in dynlayer.js, there we see this:
DynLayer.prototype.specificRemove=function() {
if (is.def && this.elm) {
this.elm.style.visibility = "hidden";
this.elm.innerHTML = "";
this.elm.outerHTML = "";
this.frame = null;
}
else if (is.ns4 && this.elm) {
if (!this.parent.doc.recycled) this.parent.doc.recycled=[];
this.parent.doc.recycled[this.parent.doc.recycled.length]=this.elm;
this.elm.visibility="hide";
}
this.bgImage = null;
this.bgColor = null;
this.html = null;
this.z = null;
this.w = null;
this.h = null;
this.elm = null;
this.doc = null;
this.css = null;};
If you're using all but the latest cvs version, you
might not have the line this.elm.visibility="hide";
in there, which is why deleteChild() wasn't working
in NS4.
As you can see in ns4 the layers are being added to
an array, for recycling.
I am wondering, shouldn't this.z be set to 0
instead of null?
I seem to remember someone saying
that.
Cheers,
Richard Bennett
Richard Bennett
[EMAIL PROTECTED]
www.richardinfo.com
(Everything running on, and ported to DynAPI2.53)
visit the DynAPI homepage (and FAQ) ::
http://dynapi.sourceforge.net/dynapi/index.php?menu=1
Browse (and search) the mailinglist here:
http://www.mail-archive.com/index.php3?hunt=dynapi
www.richardinfo.com
(Everything running on, and ported to DynAPI2.53)
visit the DynAPI homepage (and FAQ) ::
http://dynapi.sourceforge.net/dynapi/index.php?menu=1
Browse (and search) the mailinglist here:
http://www.mail-archive.com/index.php3?hunt=dynapi
----- Original Message -----
From: "D. Joannou" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 17 June, 2001 07:01
Subject: RE: Re[5]: [Dynapi-Dev]
Attention...
> Obviously it is not handled by the DynAPI, because
> the deleteChild function instead of hiding the layer
> does a "delete c" as we know already.
>
> If what you say were true, then THAT shouldn't be happening.
>
> simple!
>
> Correct me if I am wrong, but people should then bare in mind that
> it's not being handled for Netscape at this very moment, although
> it was intended to have been, and will be probably some time in the
> future. For the time being, I guess, people should be doing a
> removeChild() and a setVisible(false).
>
> I was not aware of the built-in recycling and haven't got the faintest
> as to how to use it, although I am sure that it would be very usefull.
>
> Deli Joannou
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Robert
> Rainwater
> Sent: 17 June 2001 05:14
> To: D. Joannou
> Subject: Re[5]: [Dynapi-Dev] Attention...
>
>
>
> All of this is already handled by the DynAPI. If you look at the code
> you will see that when you remove a layer in NS 4 is hides the layes
> and puts it in a recycled array so that it can be used later. I'm not
> sure what the bad news is. NS4 has always been this way.
>
> --
> Robert Rainwater
>
>
> On 6/16/2001, 11:30:24 PM EST, D. wrote about "[Dynapi-Dev] Attention...":
>
> > BAD NEWS PEOPLE - Unless what I have found out is not true (I wish)!
>
> > I have also been plagued by the deleteChild/deleteFromParent syndrome,
> > on several occasions and had to resort to work-arounds.
> > Tonight I came accross it again writting a dynamic explorer-like tree
> > structure.
> > I really need to DELETE the children cause the REMOVE acts a bit funny in
> > Netscape.
>
> > Have a look at this...
> > http://www.faqts.com/knowledge_base/view.phtml/aid/7260/fid/53 and
> > http://www.faqts.com/knowledge_base/view.phtml/aid/7232/fid/53
>
> > they say:
>
> > "You can dereference an object (whose memory may then be reclaimed by the
> > garbage collector) by assigning it to null ("myObject=null"), or by
> > applying the delete operator to it ("delete myObject"). However, layers
> > in NN4 are a permanent part of the HTML code, thus they can't be
> > disposed of. Remember that NN4 only allows modifications to the page
> > code in loading time, and that every piece of HTML you write (with
> > document.write()) appears and behaves like if it was hardcoded.
>
> > All you can do is hiding them (with
> > document.layername.visibility='hide'), but that doesn?t help since the
> > layers are still there for all counts--except that they can't be seen."
>
> > and
>
> > "You can't deleta a layer, but you can hide it so it will be invisible to
> > the user. Simply add
> > document.layers['myLayer'].visibility='hide';
> > in your script to hide it ('myLayer' is the name of your layer in the
> > HTML code).
>
> > Conversely,
> > document.layers['myLayer'].visibility='show';
> > will show your layer again.
>
> > This only works in NS4.x."
>
>
> > If this is TRUE, then it is BAD NEWS as I said, and all that's left is
> > REALLY,
> > 1. scrap Netscape 4.x and concentrate on 6.x or
> > 2. recycle!!
>
> > Deli Joannou
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Stephan
> > Tolksdorf
> > Sent: 16 June 2001 12:44
> > To: Robert Rainwater
> > Subject: Re[3]: [Dynapi-Dev] Attention...
>
>
> >> I will fix the bug soon. However, your fix does not delete the
> >> object, but the array element.
>
> > As I understand it, delete doesn't delete an object but cuts the
> > variable (or the attribute) and therefore the reference out of the
> > namescape.
>
> >> I believe this would cause a memory
> >> problems.
>
> > That depends on whether local variables get garbage collected after
> > gone out of scope. I don't think that browsers will have a problem
> > with this.
>
> > But you can still assign null instead of deleting.
> > __
> > c.del()
> > this.children[i] = this.children[l-1];
> > this.children[l-1] = null;
> > this.children.length--;
> > c = null // instead of delete c
> > __
>
> > This would work for Netscape.
>
>
> > Stephan
>
>
> > PS: Didn't want Jeff Greenberg to write a tutorial about memory
> > optimization?
>
>
> > _______________________________________________
> > Dynapi-Dev mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/dynapi-dev
>
>
> > _______________________________________________
> > Dynapi-Dev mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/dynapi-dev
>
>
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-dev
>
>
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-dev
>