Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

I see. Still, your approach leaks memory as it maintains references to nodes which may otherwise be GC'able. Have you considered `WeakMap` for caching (where supported)?


view as:

That's a good point. I probably will add some sort of destroy method. I figure in most cases with delegation you are referencing an element that is not likely to be removed (such as document), but I probably should add a way to clean up stale objects.

As for WeakMap, I wasn't even aware of that, looks awesome.


Legal | privacy