]> source.dussan.org Git - jquery.git/commitdiff
We removed deleteExpando after 1.4.2, for some reason. This caused problems with...
authorJohn Resig <jeresig@gmail.com>
Sun, 17 Oct 2010 14:56:01 +0000 (10:56 -0400)
committerJohn Resig <jeresig@gmail.com>
Sun, 17 Oct 2010 14:56:01 +0000 (10:56 -0400)
src/support.js
test/unit/data.js

index c2ffa45f24154b4011987d5de8e933c7dd13986b..b9c10c7a208fa03a260c5b8e5e886d13fa6a98c9 100644 (file)
@@ -61,6 +61,7 @@
                optSelected: opt.selected,
 
                // Will be defined later
+               deleteExpando: true,
                optDisabled: false,
                checkClone: false,
                scriptEval: false,
                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 ) {
index 81f5e61fae77720d768f524adda156710d00dd84..b0c9f3f82b018920fc1941a4fe1675ad68fca577 100644 (file)
@@ -284,11 +284,16 @@ test(".data(Object)", function() {
 });
 
 test("jQuery.removeData", function() {
-       expect(5);
+       expect(7);
        var div = jQuery("#foo")[0];
        jQuery.data(div, "test", "testing");
        jQuery.removeData(div, "test");
        equals( jQuery.data(div, "test"), undefined, "Check removal of data" );
+
+       jQuery.data(div, "test2", "testing");
+       jQuery.removeData( div );
+       ok( !jQuery.data(div, "test2"), "Make sure that the data property no longer exists." );
+       ok( !div[ jQuery.expando ], "Make sure the expando no longer exists, as well." );
        
        var obj = {};
        jQuery.data(obj, "test", "testing");