// If we actually just moused on to a sub-element, ignore it
if ( p == this ) return false;
// If we actually just moused on to a sub-element, ignore it
if ( p == this ) return false;
* Please ensure you have no code in your <body> onload event handler,
* otherwise $(document).ready() may not fire.
*
* Please ensure you have no code in your <body> onload event handler,
* otherwise $(document).ready() may not fire.
*
* 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.
*
* 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.
*
* @example $("p").load();
* @before <p onload="alert('Hello');">Hello</p>
* @result alert('Hello');
*
* @name load
* @example $("p").load();
* @before <p onload="alert('Hello');">Hello</p>
* @result alert('Hello');
*
* @name load
- * 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) {
* "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," +
* "submit,keydown,keypress,keyup,error").split(",");
* var handler1 = function(event) {
- jQuery.fn[o] = function(f){
- return f ? this.bind(o, f) : this.trigger(o);
+ jQuery.fn[o] = function(f, amount){
+ return f ? this.bind(o, f, amount) : this.trigger(o);
// Finally, handle events that only fire once
jQuery.fn["one"+o] = function(f){
// Finally, handle events that only fire once
jQuery.fn["one"+o] = function(f){
- // Attach the event listener
- return this.each(function(){
-
- var count = 0;
-
- // Add the event
- jQuery.event.add( this, o, function(e){
- // If this function has already been executed, stop
- if ( count++ ) return;
-
- // And execute the bound function
- return f.apply(this, [e]);
- });
- });
+ // use bind with amount param to bind only once
+ return this.bind(o, f, 1);
+
+// Clean up after IE to avoid memory leaks
+if (jQuery.browser.msie) jQuery(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 if (type != 'unload') event.remove(els[i-1], type); while (--i);
+ }
+});