Thanks for valuable info!

But these aren't really "attributes", at least in the HTML sense. They're
what I call custom properties, and a central plank of object-oriented
javascript t'boot. I use them all the time, but had no idea they were called
"expandos" (horrid name), or  - more importantly - that they could cause
garbage collection problems.

I'll read up on this.

Thanks, again

Chris

On 3/1/07, Mike Alsup <[EMAIL PROTECTED]> wrote:

> Please correct me if I'm understanding this the wrong way. Strings are
safe.
> Object references are not.

That's correct.  It's safe to store primitives in an expando because
the aren't reference counted for garbage collection.  But objects are
trouble.  An IE memory leak pattern is as simple as this:

var o = document.getElementById('A');
document.getElementById('A').myprop = o;

Jack Slocum has a good blog entry on avoiding memory leaks:


http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/

Mike

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
Chris Ovenden

http://thepeer.blogspot.com
"Imagine all the people / Sharing all the world"
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to