3 ms·
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
by strager 14y ago
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)?
- craigc 14y agoThat'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.