Clean up expando removal code - only try to delete the expando from an element if it's possible.

This commit is contained in:
jeresig 2010-02-13 06:32:20 -05:00
parent da966573c3
commit 9195107dbb
3 changed files with 19 additions and 29 deletions

View file

@ -547,7 +547,9 @@ jQuery.extend({
},
cleanData: function( elems ) {
var data, id, cache = jQuery.cache, special = jQuery.event.special;
var data, id, cache = jQuery.cache,
special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
id = elem[ jQuery.expando ];
@ -566,7 +568,9 @@ jQuery.extend({
}
}
removeExpando( elem );
if ( deleteExpando ) {
delete elem[ expando ];
}
delete cache[ id ];
}