diff options
author | jeresig <jeresig@gmail.com> | 2010-02-13 06:57:58 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-02-13 06:57:58 -0500 |
commit | a6f3757d50f8be021505f4f7fa7201199e8b7f2d (patch) | |
tree | 295d594132dfbeeedfef504bf525dfd596139b0b | |
parent | 9195107dbb13ad34ae4e9f7cb1df5d79e4748560 (diff) | |
download | jquery-a6f3757d50f8be021505f4f7fa7201199e8b7f2d.tar.gz jquery-a6f3757d50f8be021505f4f7fa7201199e8b7f2d.zip |
Found a better detect for deleting an expando, added back in removeAttribute as it does work in IE.
-rw-r--r-- | src/data.js | 5 | ||||
-rw-r--r-- | src/manipulation.js | 5 | ||||
-rw-r--r-- | src/support.js | 19 |
3 files changed, 17 insertions, 12 deletions
diff --git a/src/data.js b/src/data.js index 0e243ca61..b9986f58d 100644 --- a/src/data.js +++ b/src/data.js @@ -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 diff --git a/src/manipulation.js b/src/manipulation.js index 4eb19eaf0..196f23072 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -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 ]; diff --git a/src/support.js b/src/support.js index c9bfdf0b9..5821301a9 100644 --- a/src/support.js +++ b/src/support.js @@ -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; }); |