Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cross frame references to objects that do no longer exist?

Status
Not open for further replies.

RbgoWeb

Programmer
Apr 10, 2002
91
NL
What to do with cross frame references to objects that do no longer exist?

Inside the page that publishes the frameset, index.php, there is a javascript blinking object, ojs.blinker, that alternates a html element its classname, between two css rule names, every 500ms.

In the content page this object is brought within scope with
var ojs = top.ojs;

and elements can be pushed for blinking like this:
<div class="cssrule0" cls0="cssrule0" cls1="cssrule1" onclick="ojs.blinker.push(this)">some content</div>

Remarks:
When the content page refreshes, that object is ofcourse rebuild.
The reference to the previous object inside ojs.blinker still exists, and can be refered to without error!, but doesn't do anything.
Inside ojs.blinker difference can be detected in obj its parentElement which offers some obj state detection...
obj.parentElement=[Object] and
obj.parentElement=null
This is where I remove obj from the array for the 500 ms blinker cycle.

Question:
What to do with obj after this?
Should I delete it?
Is this a memory leak?
Or does it belong to any history object now?
 
If the element that "obj" points to is no longer there, then you don't need to do anything. If you really want to set "obj" to null, there's no problem doing so. You might even use the little-documented "delete" call:

Code:
delete obj;

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
For now I only remove it from the blinker array.
The reason for obj not removed by the browser is most probably not because I have a reference to it, but should have some other purpose.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top