From: Dave Methvin Date: Sat, 6 Dec 2014 21:51:50 +0000 (-0500) Subject: Manipulation: Plug an IE8 memory leak in noCloneEvent feature detect X-Git-Tag: 3.0.0-alpha1+compat~189 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=faf295a6d85ea716bd795609efdd855938144512;p=jquery.git Manipulation: Plug an IE8 memory leak in noCloneEvent feature detect Fixes gh-1840 This feature detect could be simplified now that the only supported browser with this problem is IE8. --- diff --git a/src/manipulation/support.js b/src/manipulation/support.js index e7345eb3f..3ac54f4bb 100644 --- a/src/manipulation/support.js +++ b/src/manipulation/support.js @@ -48,16 +48,8 @@ define([ support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - support.noCloneEvent = true; - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } + // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+ + support.noCloneEvent = !!div.addEventListener; // Execute the test only if not already executed in another module. if (support.deleteExpando == null) {