Move element cache to the element[expando] to avoid cleanup and reduce code.
|Reported by:||john.david.dalton@…||Owned by:||rwaldron|
Soo way back in 2005 Dean Edwards proposed an event system that slapped the listeners on the actual element. This allowed cache to be destroyed once the element was GC'ed. http://dean.edwards.name/weblog/2005/10/add-event2/
Over the weekend Peter Michaux proposed a similar solution: https://twitter.com/#!/petermichaux/status/189012245483757568 https://github.com/petermichaux/evento/blob/bd065a9b254a8d14b956ec438dc06c29622c3ef6/src/eventTarget.js#L165
I noticed that jQuery supports events on vanilla objects too so this change would align elements and objects.
The gist is that since jQuery is already adding an expando for a UID they can just use that property as the actual storage for the element.
Then all the code to recursively clean .removed'ed elements event/custom data could be removed as when the element is GC'ed that data is destroyed.
Change History (23)
comment:4 Changed 4 years ago by dmethvin
- Component changed from unfiled to event
- Priority changed from undecided to low
comment:7 Changed 3 years ago by rwaldron
- Resolution set to fixed
- Status changed from assigned to closed
comment:17 Changed 3 years ago by rwaldron
- Milestone 2.0 deleted
- Resolution fixed deleted
- Status changed from closed to reopened
comment:18 Changed 3 years ago by dmethvin
- Milestone set to 1.11/2.1
- Status changed from reopened to open
comment:19 Changed 3 years ago by jzaefferer
comment:22 Changed 3 years ago by dmethvin
- Component changed from event to data
- Milestone changed from 1.next/2.next to 1.12/2.2