On 1/6/11, Peter van der Zee <[email protected]> wrote: > On Jan 6, 10:28 pm, Bryan Forbes <[email protected]> wrote: >> So, you would do something like this when attaching the initial event, >> right?: >> >> if(typeof elem._id == "undefined"){ >> elem._id = generateEventHandlerID(); >> >> } > > Indeed >
When another code finds that object and adds an `_id` property, perhaps in a different version of a rendition of this approach, then what? Likely, if the object is window. Adding an expando can cause errors in some cases, IIRC, though I can[t remember specifics. Creating a property of the function object and keeping reference to the elements avoids the expando. But that's not good because you're mutating the function object input. What if something else modifies the "_id"? That's not your function, so not modifying it is safer. Create a wrapper or wrapped callback function, keep that private, so its yours. Create a collection of those wrappers. It's a bit of work and not so easy. AFAIK MSIE closure based memory leaks was addressed in IE6 sp2. -- Garret -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
