X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fevent%2Fevent.js;h=81c62d83b13339aa64ba60f095895557e28ac7c4;hb=e218628dda347f5aa9241046780f3345713d7a35;hp=3d38b416b5bea208c8f4dded6386513a2385a8d9;hpb=644256759f959b30c6e041adb46714675421fb5d;p=jquery.git diff --git a/src/event/event.js b/src/event/event.js index 3d38b41..81c62d8 100644 --- a/src/event/event.js +++ b/src/event/event.js @@ -80,7 +80,7 @@ jQuery.fn.extend({ var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; // Traverse up the tree - while ( p && p != this ) try { p = p.parentNode } catch(e) { p = null; }; + while ( p && p != this ) try { p = p.parentNode } catch(e) { p = this; }; // If we actually just moused on to a sub-element, ignore it if ( p == this ) return false; @@ -107,6 +107,8 @@ jQuery.fn.extend({ * Please ensure you have no code in your <body> onload event handler, * otherwise $(document).ready() may not fire. * + * You can have as many $(document).ready events on your page as you like. + * * @example $(document).ready(function(){ Your code here... }); * * @name ready @@ -153,6 +155,9 @@ jQuery.extend({ // Reset the list of functions jQuery.readyList = null; } + // Remove event lisenter to avoid memory leak + if ( jQuery.browser.mozilla || jQuery.browser.opera ) + document.removeEventListener( "DOMContentLoaded", jQuery.ready, false ); } } }); @@ -1657,6 +1662,6 @@ if ($.browser.msie) $(window).unload(function() { var event = jQuery.event, global = event.global; for (var type in global) { var els = global[type], i = els.length; - if (i>0) do event.remove(els[i-1], type); while (--i); + if (i>0) do if (type != 'unload') event.remove(els[i-1], type); while (--i); } });