Further optimize the empty/remove/cleanData logic.

This commit is contained in:
jeresig 2010-01-28 15:25:52 -05:00
parent 0252b78201
commit 98c7248518
3 changed files with 80 additions and 40 deletions

View file

@ -132,3 +132,22 @@ jQuery.fn.extend({
});
}
});
var removeExpando = function( elem ) {
delete elem[ expando ];
};
try {
var div = document.createElement("div");
div[ expando ] = true;
delete div[ expando ];
} catch( e ) {
// IE has trouble directly removing the expando
// but it's ok with using removeAttribute
removeExpando = function( elem ) {
if ( elem.removeAttribute ) {
elem.removeAttribute( expando );
}
};
}