Further optimize the empty/remove/cleanData logic.
This commit is contained in:
parent
0252b78201
commit
98c7248518
3 changed files with 80 additions and 40 deletions
19
src/data.js
19
src/data.js
|
@ -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 );
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue