mirror of
https://github.com/jquery/jquery.git
synced 2026-02-19 09:24:23 -05:00
Data: remove the expando when there's no more data
Fixes gh-1760 Close gh-2271
This commit is contained in:
@@ -120,10 +120,7 @@ Data.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( key === undefined ) {
|
||||
this.register( owner );
|
||||
|
||||
} else {
|
||||
if ( key !== undefined ) {
|
||||
|
||||
// Support array or space separated string of keys
|
||||
if ( jQuery.isArray( key ) ) {
|
||||
@@ -147,6 +144,11 @@ Data.prototype = {
|
||||
delete cache[ key[ i ] ];
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the expando if there's no more data
|
||||
if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
|
||||
delete owner[ this.expando ];
|
||||
}
|
||||
},
|
||||
hasData: function( owner ) {
|
||||
var cache = owner[ this.expando ];
|
||||
|
||||
Reference in New Issue
Block a user