Data: move element cache to element[expando]

- avoid explicit data.discard() cleanup calls
- explicitly remove the data.events property, only when private data exists
- reduces code footprint

Fixes gh-1734
Close gh-1428
This commit is contained in:
Rick Waldron
2013-11-11 13:13:22 -05:00
committed by Timmy Willison
parent 95fb798980
commit d702b7637a
4 changed files with 65 additions and 73 deletions

View File

@@ -216,8 +216,12 @@ jQuery.event = {
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
// Normally this should go through the data api
// but since event.js owns these properties,
// this exception is made for the sake of optimizing
// the operation.
delete elemData.handle;
dataPriv.remove( elem, "events" );
delete elemData.events;
}
},