On Sun, Oct 18, 2009 at 11:06 AM, Robert Katić <[email protected]>wrote:
>
> Andrea, IE is nor open source, so I can not be sure if "new Number" is
> 100% safe as element property.
Robert, I have already posted a test. In IE if you store a primitive, it's
exposed, if you store an instanceof Object, it's not.
Same is for functions (e.g. onclick) or whatever else.
Anyway, this is the test I have done without leaks and for several times.
onload = function(){
alert("snap"); // use alert/snaps to monitor memory usage via task
manager
for(var i = 0, body = document.body, t = new Date, div; i < 20000; ++i){
div = body.appendChild(document.createElement("div"));
div.expando = new Number(i);
};
alert(new Date - t);
div = i = null;
t = new Date;
body.innerHTML = "";
alert(new Date - t);
for(var i = 0, body = document.body, t = new Date, div; i < 20000; ++i){
div = body.appendChild(document.createElement("div"));
div.expando = i;
};
alert(new Date - t);
div = i = null;
t = new Date;
body.innerHTML = "";
alert(new Date - t);
};
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---