X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fevent.js;h=f082e7eff597f2ed0373467cdc7bf95e03c2d3b8;hb=0aa8d40cdfb50fd423a3bdcf585ac27f89df5b97;hp=90abe037fe6995727b2fbeef218225d7d9233816;hpb=69cbcf863769e64f0a11c68a1846cd0e9785d25f;p=jquery.git diff --git a/src/event.js b/src/event.js index 90abe03..f082e7e 100644 --- a/src/event.js +++ b/src/event.js @@ -467,7 +467,7 @@ jQuery.fn.extend({ }, hover: function(fnOver, fnOut) { - return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut); + return this.mouseenter(fnOver).mouseleave(fnOut); }, ready: function(fn) { @@ -526,21 +526,33 @@ function bindReady(){ // Use the handy event callback document.addEventListener( "DOMContentLoaded", jQuery.ready, false ); - // If IE is used and is not in a frame - // Continually check to see if the document is ready - if ( jQuery.browser.msie && window == top ) (function(){ - if (jQuery.isReady) return; - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch( error ) { - setTimeout( arguments.callee, 0 ); - return; - } - // and execute any waiting functions - jQuery.ready(); - })(); + // If IE event model is used + if ( document.attachEvent ) + // ensure firing before onload, + // maybe late but safe also for iframes + document.attachEvent("onreadystatechange", function(e) { + if ( document.readyState == "complete" ) { + document.detachEvent("onreadystatechange", arguments.callee ); + jQuery.ready(); + } + }); + + // If IE and not an iframe + if ( document.documentElement.doScroll && !window.frameElement ) + // continually check to see if the document is ready + (function(){ + if (jQuery.isReady) return; + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + document.documentElement.doScroll("left"); + } catch( error ) { + setTimeout( arguments.callee, 0 ); + return; + } + // and execute any waiting functions + jQuery.ready(); + })(); if ( jQuery.browser.opera ) document.addEventListener( "DOMContentLoaded", function () {