X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fevent%2Fevent.js;h=186fa0daeb4fe189b54e9814476b20548272ed9d;hb=7654d3b833c0161aacc66abd6d861f53f9d8c395;hp=b273ad819074cf34ee7b7a15e9490f89135992ef;hpb=eff56887b164b489bb792f87770b7ba69e8f54df;p=jquery.git diff --git a/src/event/event.js b/src/event/event.js index b273ad8..186fa0d 100644 --- a/src/event/event.js +++ b/src/event/event.js @@ -16,7 +16,7 @@ jQuery.fn.extend({ * $(this).removeClass("selected"); * }); * - * var count = 0; + * @test var count = 0; * var fn1 = function() { count++; } * var fn2 = function() { count--; } * var link = $('#mark'); @@ -71,7 +71,7 @@ jQuery.fn.extend({ * @param Function over The function to fire whenever the mouse is moved over a matched element. * @param Function out The function to fire whenever the mouse is moved off of a matched element. * @cat Events - */ + */ hover: function(f,g) { // A private function for haandling mouse 'hovering' @@ -720,11 +720,15 @@ new function(){ * Trigger the load event of each matched element. This causes all of the functions * that have been bound to thet load event to be executed. * + * Marked as private: Calling load() without arguments throws exception because the ajax load + * does not handle it. + * * @example $("p").load(); * @before

Hello

* @result alert('Hello'); * * @name load + * @private * @type jQuery * @cat Events/Browser */ @@ -1451,9 +1455,78 @@ new function(){ * @cat Events/Mouse */ + /** + * Bind a function to the mouseover event of each matched element. + * + * @example $("p").mouseover( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

+ * + * @name mouseover + * @type jQuery + * @param Function fn A function to bind to the mousedown event on each of the matched elements. + * @cat Events/Mouse + */ + + /** + * Trigger the mouseover event of each matched element. This causes all of the functions + * that have been bound to thet mousedown event to be executed. + * + * @example $("p").mouseover(); + * @before

Hello

+ * @result alert('Hello'); + * + * @name mouseover + * @type jQuery + * @cat Events/Mouse + */ + + /** + * Bind a function to the mouseover event of each matched element, which will only be executed once. + * Unlike a call to the normal .mouseover() method, calling .onemouseover() causes the bound function to be + * only executed the first time it is triggered, and never again (unless it is re-bound). + * + * @example $("p").onemouseover( function() { alert("Hello"); } ); + * @before

Hello

+ * @result alert('Hello'); // Only executed for the first mouseover + * + * @name onemouseover + * @type jQuery + * @param Function fn A function to bind to the mouseover event on each of the matched elements. + * @cat Events/Mouse + */ + + /** + * Removes a bound mouseover event from each of the matched + * elements. You must pass the identical function that was used in the original + * bind method. + * + * @example $("p").unmouseover( myFunction ); + * @before

Hello

+ * @result

Hello

+ * + * @name unmouseover + * @type jQuery + * @param Function fn A function to unbind from the mouseover event on each of the matched elements. + * @cat Events/Mouse + */ + + /** + * Removes all bound mouseover events from each of the matched elements. + * + * @example $("p").unmouseover(); + * @before

Hello

+ * @result

Hello

+ * + * @name unmouseover + * @type jQuery + * @cat Events/Mouse + */ + /** * @test var count; - * var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," + + * // ignore load + * var e = ("blur,focus,resize,scroll,unload,click,dblclick," + * "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," + * "submit,keydown,keypress,keyup,error").split(","); * var handler1 = function(event) { @@ -1486,11 +1559,12 @@ new function(){ * $(document)[event](); * * // assert count - * @test ok( count == 6, 'Checking event ' + event); + * ok( count == 6, 'Checking event ' + event); * } * * @private * @name eventTesting + * @cat Events */ var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," + @@ -1577,3 +1651,12 @@ new function(){ jQuery.event.add( window, "load", jQuery.ready ); }; + +// Clean up after IE to avoid memory leaks +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); + } +});