]> source.dussan.org Git - jquery.git/commitdiff
Test for window inference. Fixes #10080 468/head
authorrwldrn <waldron.rick@gmail.com>
Thu, 18 Aug 2011 14:17:12 +0000 (10:17 -0400)
committerrwldrn <waldron.rick@gmail.com>
Thu, 18 Aug 2011 14:17:12 +0000 (10:17 -0400)
src/data.js
test/unit/data.js

index 936cd76b80bc293368dd66ab915536a469f7c295..4914971ea46b743b40abe90635230aea9c906c4e 100644 (file)
@@ -191,8 +191,8 @@ jQuery.extend({
                // Browsers that fail expando deletion also refuse to delete expandos on
                // the window, but it will allow it on all other JS objects; other browsers
                // don't care
-               // Ensure that this id actually exists in `cache` #10080
-               if ( cache[ id ] && ( jQuery.support.deleteExpando || cache != window ) ) {
+               // Ensure that `cache` is not a window object #10080
+               if ( jQuery.support.deleteExpando || !cache.setInterval ) {
                        delete cache[ id ];
                } else {
                        cache[ id ] = null;
index 4e21f563e7b54d227606183e199a71499ebb4287..06c6c2d57f01512a2b1fedf643a95cc942e9e089 100644 (file)
@@ -582,3 +582,16 @@ test("jQuery.data supports interoperable removal of hyphenated/camelCase propert
 
        });
 });
+
+// Test originally by Moschel
+test("Triggering the removeData should not throw exceptions. (#10080)", function() {
+       expect(1);
+       stop();
+       var frame = jQuery("#loadediframe");
+       jQuery(frame[0].contentWindow).bind("unload", function() {
+               ok(true, "called unload");
+               start();
+       });
+       // change the url to trigger unload
+       frame.attr("src", "data/iframe.html?param=true");
+});