* data as the second paramter (and the handler function as the third), see
* second example.
*
- * @example $("p").bind( "click", function() {
+ * @example $("p").bind("click", function(){
* alert( $(this).text() );
- * } )
+ * });
* @before <p>Hello</p>
* @result alert("Hello")
*
- * @example var handler = function(event) {
+ * @example function handler(event) {
* alert(event.data.foo);
- * };
- * $("p").bind( "click", {foo: "bar"}, handler)
+ * }
+ * $("p").bind("click", {foo: "bar"}, handler)
* @result alert("bar")
* @desc Pass some additional data to the event handler.
*
- * @example $("form").bind( "submit", function() { return false; } )
+ * @example $("form").bind("submit", function() { return false; })
* @desc Cancel a default action and prevent it from bubbling by returning false
* from your function.
*
- * @example $("form").bind( "submit", function(event) {
+ * @example $("form").bind("submit", function(event){
* event.preventDefault();
- * } );
+ * });
* @desc Cancel only the default action by using the preventDefault method.
*
*
- * @example $("form").bind( "submit", function(event) {
+ * @example $("form").bind("submit", function(event){
* event.stopPropagation();
- * } )
+ * });
* @desc Stop only an event from bubbling by using the stopPropagation method.
*
* @name bind
* data as the second paramter (and the handler function as the third), see
* second example.
*
- * @example $("p").one( "click", function() {
+ * @example $("p").one("click", function(){
* alert( $(this).text() );
- * } )
+ * });
* @before <p>Hello</p>
* @result alert("Hello")
*
});
},
- // We're overriding the old toggle function, so
- // remember it for later
- _toggle: jQuery.fn.toggle,
-
/**
* Toggle between two function calls every other click.
* Whenever a matched element is clicked, the first specified function
* @cat Events
*/
toggle: function() {
- // save reference to arguments for access in closure
+ // Save reference to arguments for access in closure
var a = arguments;
- return typeof a[0] == "function" && typeof a[1] == "function" ? this.click(function(e) {
+
+ return this.click(function(e) {
// Figure out which function to execute
this.lastToggle = this.lastToggle == 0 ? 1 : 0;
// and execute the function
return a[this.lastToggle].apply( this, [e] ) || false;
- }) :
-
- // Otherwise, execute the old toggle function
- this._toggle.apply( this, arguments );
+ });
},
/**
* @name scroll
* @type jQuery
* @param Function fn A function to bind to the scroll event on each of the matched elements.
- * @cat Events/Browser
+ * @cat Events
*/
/**
* @name submit
* @type jQuery
* @param Function fn A function to bind to the submit event on each of the matched elements.
- * @cat Events/Form
+ * @cat Events
*/
/**
*
* @name submit
* @type jQuery
- * @cat Events/Form
+ * @cat Events
*/
/**
* @name focus
* @type jQuery
* @param Function fn A function to bind to the focus event on each of the matched elements.
- * @cat Events/UI
+ * @cat Events
*/
/**
*
* @name focus
* @type jQuery
- * @cat Events/UI
+ * @cat Events
*/
/**
* @name keydown
* @type jQuery
* @param Function fn A function to bind to the keydown event on each of the matched elements.
- * @cat Events/Keyboard
+ * @cat Events
*/
/**
* @name dblclick
* @type jQuery
* @param Function fn A function to bind to the dblclick event on each of the matched elements.
- * @cat Events/Mouse
+ * @cat Events
*/
/**
* @name keypress
* @type jQuery
* @param Function fn A function to bind to the keypress event on each of the matched elements.
- * @cat Events/Keyboard
+ * @cat Events
*/
/**
* @name error
* @type jQuery
* @param Function fn A function to bind to the error event on each of the matched elements.
- * @cat Events/Browser
+ * @cat Events
*/
/**
* @name blur
* @type jQuery
* @param Function fn A function to bind to the blur event on each of the matched elements.
- * @cat Events/UI
+ * @cat Events
*/
/**
*
* @name blur
* @type jQuery
- * @cat Events/UI
+ * @cat Events
*/
/**
* @name load
* @type jQuery
* @param Function fn A function to bind to the load event on each of the matched elements.
- * @cat Events/Browser
+ * @cat Events
*/
/**
* @name select
* @type jQuery
* @param Function fn A function to bind to the select event on each of the matched elements.
- * @cat Events/Form
+ * @cat Events
*/
/**
*
* @name select
* @type jQuery
- * @cat Events/Form
+ * @cat Events
*/
/**
* @name mouseup
* @type jQuery
* @param Function fn A function to bind to the mouseup event on each of the matched elements.
- * @cat Events/Mouse
+ * @cat Events
*/
/**
* @name unload
* @type jQuery
* @param Function fn A function to bind to the unload event on each of the matched elements.
- * @cat Events/Browser
+ * @cat Events
*/
/**
* @name change
* @type jQuery
* @param Function fn A function to bind to the change event on each of the matched elements.
- * @cat Events/Form
+ * @cat Events
*/
/**
* @name mouseout
* @type jQuery
* @param Function fn A function to bind to the mouseout event on each of the matched elements.
- * @cat Events/Mouse
+ * @cat Events
*/
/**
* @name keyup
* @type jQuery
* @param Function fn A function to bind to the keyup event on each of the matched elements.
- * @cat Events/Keyboard
+ * @cat Events
*/
/**
* @name click
* @type jQuery
* @param Function fn A function to bind to the click event on each of the matched elements.
- * @cat Events/Mouse
+ * @cat Events
*/
/**
*
* @name click
* @type jQuery
- * @cat Events/Mouse
+ * @cat Events
*/
/**
* @name resize
* @type jQuery
* @param Function fn A function to bind to the resize event on each of the matched elements.
- * @cat Events/Browser
+ * @cat Events
*/
/**
* @name mousemove
* @type jQuery
* @param Function fn A function to bind to the mousemove event on each of the matched elements.
- * @cat Events/Mouse
+ * @cat Events
*/
/**
* @name mousedown
* @type jQuery
* @param Function fn A function to bind to the mousedown event on each of the matched elements.
- * @cat Events/Mouse
+ * @cat Events
*/
/**
* @name mouseover
* @type jQuery
* @param Function fn A function to bind to the mousedown event on each of the matched elements.
- * @cat Events/Mouse
+ * @cat Events
*/
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
jQuery.event.remove(els[i-1], type);
while (--i);
}
- });
\ No newline at end of file
+ });