Found a better detect for deleting an expando, added back in removeAttribute as it does work in IE.

This commit is contained in:
jeresig 2010-02-13 06:57:58 -05:00
parent 9195107dbb
commit a6f3757d50
3 changed files with 17 additions and 12 deletions

View file

@ -80,7 +80,10 @@ jQuery.extend({
// Otherwise, we want to remove all of the element's data
} else {
if ( jQuery.support.deleteExpando ) {
delete elem[ expando ];
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
// Completely remove the data cache

View file

@ -569,7 +569,10 @@ jQuery.extend({
}
if ( deleteExpando ) {
delete elem[ expando ];
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];

View file

@ -81,6 +81,15 @@
delete window[ id ];
}
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete script.test;
} catch(e) {
jQuery.support.deleteExpando = false;
}
root.removeChild( script );
if ( div.attachEvent && div.fireEvent ) {
@ -112,16 +121,6 @@
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
document.body.removeChild( div ).style.display = 'none';
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
div.test = 1;
delete doc.test;
} catch(e) {
jQuery.support.deleteExpando = false;
}
div = null;
});