]> source.dussan.org Git - jquery.git/commitdiff
Fix #11757. IE 6/7 can't clean up circular DOM-JS refs.
authorDave Methvin <dave.methvin@gmail.com>
Fri, 22 Jun 2012 13:46:07 +0000 (09:46 -0400)
committerDave Methvin <dave.methvin@gmail.com>
Fri, 22 Jun 2012 13:46:07 +0000 (09:46 -0400)
Why? Because it's dumb. Verified with the case in the ticket.

src/support.js

index 612e2942b0352482d903163b48b8fba4af7d44c0..9d25c8f29b3d5eb7d87a531f7dc6bdef46e514b4 100644 (file)
@@ -10,6 +10,7 @@ jQuery.support = (function() {
                eventName,
                i,
                isSupported,
+               clickFn,
                div = document.createElement("div");
 
        // Preliminary tests
@@ -112,12 +113,13 @@ jQuery.support = (function() {
        }
 
        if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
-               div.attachEvent( "onclick", function() {
+               div.attachEvent( "onclick", clickFn = function() {
                        // Cloning a node shouldn't copy over any
                        // bound event handlers (IE does this)
                        support.noCloneEvent = false;
                });
                div.cloneNode( true ).fireEvent("onclick");
+               div.detachEvent( "onclick", clickFn );
        }
 
        // Check if a radio maintains its value