From ed867fe6f8be7e6e1eeb948e5f7a3a9e6ee1f63e Mon Sep 17 00:00:00 2001 From: John Resig Date: Sat, 29 Jul 2006 04:17:07 +0000 Subject: [PATCH] Massive documentation updates, only thing left to do is ajax.js. --- event/event.js | 1387 +++++++++++++++++++++++++++++++++++++++++++++++++++++- fx/fx.js | 209 +++++++- jquery/jquery.js | 599 ++++++++++++++++++++++- 3 files changed, 2148 insertions(+), 47 deletions(-) diff --git a/event/event.js b/event/event.js index 553c568..fcb49d9 100644 --- a/event/event.js +++ b/event/event.js @@ -6,6 +6,20 @@ jQuery.fn.extend({ /** * Toggle between two function calls every other click. + * Whenever a matched element is clicked, the first specified function + * is fired, when clicked again, the second is fired. All subsequent + * clicks continue to rotate through the two functions. + * + * @example $("p").toggle(function(){ + * $(this).addClass("selected"); + * },function(){ + * $(this).removeClass("selected"); + * }); + * + * @name toggle + * @type jQuery + * @param Function even The function to execute on every even click. + * @param Function odd The function to execute on every odd click. */ toggle: function(a,b) { // If two functions are passed in, we're @@ -26,8 +40,29 @@ jQuery.fn.extend({ }, /** - * Toggle between two function calls on mouse over/out. - */ + * A method for simulating hovering (moving the mouse on, and off, + * an object). This is a custom method which provides an 'in' to a + * frequent task. + * + * Whenever the mouse cursor is moved over a matched + * element, the first specified function is fired. Whenever the mouse + * moves off of the element, the second specified function fires. + * Additionally, checks are in place to see if the mouse is still within + * the specified element itself (for example, an image inside of a div), + * and if it is, it will continue to 'hover', and not move out + * (a common error in using a mouseout event handler). + * + * @example $("p").hover(function(){ + * $(this).addClass("over"); + * },function(){ + * $(this).addClass("out"); + * }); + * + * @name hover + * @type jQuery + * @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. + */ hover: function(f,g) { // A private function for haandling mouse 'hovering' @@ -50,8 +85,25 @@ jQuery.fn.extend({ }, /** - * Bind a function to fire when the DOM is ready. - */ + * Bind a function to be executed whenever the DOM is ready to be + * traversed and manipulated. This is probably the most important + * function included in the event module, as it can greatly improve + * the response times of your web applications. + * + * In a nutshell, this is a solid replacement for using window.onload, + * and attaching a function to that. By using this method, your bound Function + * will be called the instant the DOM is ready to be read and manipulated, + * which is exactly what 99.99% of all Javascript code needs to run. + * + * Please ensure you have no code in your onload event handler, + * otherwise $(document).ready() may not fire. + * + * @example $(document).ready(function(){ /* Your code here... */ }); + * + * @name ready + * @type jQuery + * @param Function fn The function to be executed when the DOM is ready. + */ ready: function(f) { // If the DOM is already ready if ( jQuery.isReady ) @@ -96,9 +148,1330 @@ jQuery.extend({ }); new function(){ - /* - * Bind a number of event-handling functions, dynamically - */ + + /** + * Bind a function to the blur event of each matched element. + * + * @example $("p").blur( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unblur + * @type jQuery + */ + + /** + * Bind a function to the focus event of each matched element. + * + * @example $("p").focus( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unfocus + * @type jQuery + */ + + /** + * Bind a function to the load event of each matched element. + * + * @example $("p").load( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

+ * + * @name load + * @type jQuery + * @param Function fn A function to bind to the load event on each of the matched elements. + */ + + /** + * 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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unload + * @type jQuery + */ + + /** + * Bind a function to the resize event of each matched element. + * + * @example $("p").resize( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unresize + * @type jQuery + */ + + /** + * Bind a function to the scroll event of each matched element. + * + * @example $("p").scroll( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unscroll + * @type jQuery + */ + + /** + * Bind a function to the unload event of each matched element. + * + * @example $("p").unload( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name ununload + * @type jQuery + */ + + /** + * Bind a function to the click event of each matched element. + * + * @example $("p").click( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unclick + * @type jQuery + */ + + /** + * Bind a function to the dblclick event of each matched element. + * + * @example $("p").dblclick( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name undblclick + * @type jQuery + */ + + /** + * Bind a function to the mousedown event of each matched element. + * + * @example $("p").mousedown( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unmousedown + * @type jQuery + */ + + /** + * Bind a function to the mouseup event of each matched element. + * + * @example $("p").mouseup( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unmouseup + * @type jQuery + */ + + /** + * Bind a function to the mousemove event of each matched element. + * + * @example $("p").mousemove( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unmousemove + * @type jQuery + */ + + /** + * 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 mouseover event on each of the matched elements. + */ + + /** + * Trigger the mouseover event of each matched element. This causes all of the functions + * that have been bound to thet mouseover event to be executed. + * + * @example $("p").mouseover(); + * @before

Hello

+ * @result alert('Hello'); + * + * @name mouseover + * @type jQuery + */ + + /** + * 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. + */ + + /** + * 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. + */ + + /** + * Removes all bound mouseover events from each of the matched elements. + * + * @example $("p").unmouseover(); + * @before

Hello

+ * @result

Hello

+ * + * @name unmouseover + * @type jQuery + */ + + /** + * Bind a function to the mouseout event of each matched element. + * + * @example $("p").mouseout( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unmouseout + * @type jQuery + */ + + /** + * Bind a function to the change event of each matched element. + * + * @example $("p").change( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unchange + * @type jQuery + */ + + /** + * Bind a function to the reset event of each matched element. + * + * @example $("p").reset( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unreset + * @type jQuery + */ + + /** + * Bind a function to the select event of each matched element. + * + * @example $("p").select( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unselect + * @type jQuery + */ + + /** + * Bind a function to the submit event of each matched element. + * + * @example $("p").submit( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unsubmit + * @type jQuery + */ + + /** + * Bind a function to the keydown event of each matched element. + * + * @example $("p").keydown( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unkeydown + * @type jQuery + */ + + /** + * Bind a function to the keypress event of each matched element. + * + * @example $("p").keypress( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unkeypress + * @type jQuery + */ + + /** + * Bind a function to the keyup event of each matched element. + * + * @example $("p").keyup( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unkeyup + * @type jQuery + */ + + /** + * Bind a function to the error event of each matched element. + * + * @example $("p").error( function() { alert("Hello"); } ); + * @before

Hello

+ * @result

Hello

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

Hello

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

Hello

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

Hello

+ * @result

Hello

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

Hello

+ * @result

Hello

+ * + * @name unerror + * @type jQuery + */ + var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," + "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," + "submit,keydown,keypress,keyup,error").split(","); diff --git a/fx/fx.js b/fx/fx.js index df59d78..184765b 100644 --- a/fx/fx.js +++ b/fx/fx.js @@ -4,15 +4,31 @@ jQuery.fn.extend({ _show: jQuery.fn.show, /** - * The effects module overloads the show method to now allow - * for a speed to the show operation. What actually happens is - * that the height, width, and opacity to the matched elements - * are changed dynamically. The only three current speeds are - * "slow", "normal", and "fast". For example: - * $("p").show("slow"); - * Note: You should not run the show method on things - * that are already shown. This can be circumvented by doing this: - * $("p:hidden").show("slow"); + * Show all matched elements using a graceful animation. + * The height, width, and opacity of each of the matched elements + * are changed dynamically according to the specified speed. + * + * @example $("p").show("slow"); + * + * @name show + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + */ + + /** + * Show all matched elements using a graceful animation and firing a callback + * function after completion. + * The height, width, and opacity of each of the matched elements + * are changed dynamically according to the specified speed. + * + * @example $("p").show("slow",function(){ + * alert("Animation Done."); + * }); + * + * @name show + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + * @param Function callback A function to be executed whenever the animation completes. */ show: function(speed,callback){ return speed ? this.animate({ @@ -24,9 +40,31 @@ jQuery.fn.extend({ _hide: jQuery.fn.hide, /** - * The hide function behaves very similary to the show function, - * but is just the opposite. - * $("p:visible").hide("slow"); + * Hide all matched elements using a graceful animation. + * The height, width, and opacity of each of the matched elements + * are changed dynamically according to the specified speed. + * + * @example $("p").hide("slow"); + * + * @name hide + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + */ + + /** + * Hide all matched elements using a graceful animation and firing a callback + * function after completion. + * The height, width, and opacity of each of the matched elements + * are changed dynamically according to the specified speed. + * + * @example $("p").hide("slow",function(){ + * alert("Animation Done."); + * }); + * + * @name hide + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + * @param Function callback A function to be executed whenever the animation completes. */ hide: function(speed,callback){ return speed ? this.animate({ @@ -35,49 +73,170 @@ jQuery.fn.extend({ }, /** - * This function increases the height and opacity for all matched - * elements. This is very similar to 'show', but does not change - * the width - creating a neat sliding effect. - * $("p:hidden").slideDown("slow"); + * Reveal all matched elements by adjusting their height. + * Only the height is adjusted for this animation, causing all matched + * elements to be revealed in a "sliding" manner. + * + * @example $("p").slideDown("slow"); + * + * @name slideDown + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + */ + + /** + * Reveal all matched elements by adjusting their height and firing a callback + * function after completion. + * Only the height is adjusted for this animation, causing all matched + * elements to be revealed in a "sliding" manner. + * + * @example $("p").slideDown("slow",function(){ + * alert("Animation Done."); + * }); + * + * @name slideDown + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + * @param Function callback A function to be executed whenever the animation completes. */ slideDown: function(speed,callback){ return this.animate({height: "show"}, speed, callback); }, /** - * Just like slideDown, only it hides all matched elements. - * $("p:visible").slideUp("slow"); + * Hide all matched elements by adjusting their height. + * Only the height is adjusted for this animation, causing all matched + * elements to be hidden in a "sliding" manner. + * + * @example $("p").slideUp("slow"); + * + * @name slideUp + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + */ + + /** + * Hide all matched elements by adjusting their height and firing a callback + * function after completion. + * Only the height is adjusted for this animation, causing all matched + * elements to be hidden in a "sliding" manner. + * + * @example $("p").slideUp("slow",function(){ + * alert("Animation Done."); + * }); + * + * @name slideUp + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + * @param Function callback A function to be executed whenever the animation completes. */ slideUp: function(speed,callback){ return this.animate({height: "hide"}, speed, callback); }, /** - * Adjusts the opacity of all matched elements from a hidden, - * to a fully visible, state. - * $("p:hidden").fadeIn("slow"); + * Fade in all matched elements by adjusting their opacity. + * Only the opacity is adjusted for this animation, meaning that + * all of the matched elements should already have some form of height + * and width associated with them. + * + * @example $("p").fadeIn("slow"); + * + * @name fadeIn + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + */ + + /** + * Fade in all matched elements by adjusting their opacity and firing a + * callback function after completion. + * Only the opacity is adjusted for this animation, meaning that + * all of the matched elements should already have some form of height + * and width associated with them. + * + * @example $("p").fadeIn("slow",function(){ + * alert("Animation Done."); + * }); + * + * @name fadeIn + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + * @param Function callback A function to be executed whenever the animation completes. */ fadeIn: function(speed,callback){ return this.animate({opacity: "show"}, speed, callback); }, /** - * Same as fadeIn, but transitions from a visible, to a hidden state. - * $("p:visible").fadeOut("slow"); + * Fade out all matched elements by adjusting their opacity. + * Only the opacity is adjusted for this animation, meaning that + * all of the matched elements should already have some form of height + * and width associated with them. + * + * @example $("p").fadeOut("slow"); + * + * @name fadeOut + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + */ + + /** + * Fade out all matched elements by adjusting their opacity and firing a + * callback function after completion. + * Only the opacity is adjusted for this animation, meaning that + * all of the matched elements should already have some form of height + * and width associated with them. + * + * @example $("p").fadeOut("slow",function(){ + * alert("Animation Done."); + * }); + * + * @name fadeOut + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + * @param Function callback A function to be executed whenever the animation completes. */ fadeOut: function(speed,callback){ return this.animate({opacity: "hide"}, speed, callback); }, /** - * ... + * Fade the opacity of all matched elements to a specified opacity. + * Only the opacity is adjusted for this animation, meaning that + * all of the matched elements should already have some form of height + * and width associated with them. + * + * @example $("p").fadeTo("slow", 0.5); + * + * @name fadeTo + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + * @param Number opacity The opacity to fade to (a number from 0 to 1). + */ + + /** + * Fade the opacity of all matched elements to a specified opacity and + * firing a callback function after completion. + * Only the opacity is adjusted for this animation, meaning that + * all of the matched elements should already have some form of height + * and width associated with them. + * + * @example $("p").fadeTo("slow", 0.5, function(){ + * alert("Animation Done."); + * }); + * + * @name fadeTo + * @type jQuery + * @param Object speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). + * @param Number opacity The opacity to fade to (a number from 0 to 1). + * @param Function callback A function to be executed whenever the animation completes. */ fadeTo: function(speed,to,callback){ return this.animate({opacity: to}, speed, callback); }, /** - * + * @private */ animate: function(prop,speed,callback) { return this.queue(function(){ diff --git a/jquery/jquery.js b/jquery/jquery.js index 606bd5c..8be00be 100644 --- a/jquery/jquery.js +++ b/jquery/jquery.js @@ -699,6 +699,25 @@ jQuery.fn = jQuery.prototype = { } }; +/** + * + * + * @private + * @name extend + * @param Object obj + * @param Object prop + * @type Object + */ + +/** + * Extend one object with another, returning the original, + * modified, object. This is a great utility for simple inheritance. + * + * @name $.extend + * @param Object obj The object to extend + * @param Object prop The object that will be merged into the first. + * @type Object + */ jQuery.extend = jQuery.fn.extend = function(obj,prop) { if ( !prop ) { prop = obj; obj = this; } for ( var i in prop ) obj[i] = prop[i]; @@ -706,6 +725,13 @@ jQuery.extend = jQuery.fn.extend = function(obj,prop) { }; jQuery.extend({ + /** + * + * + * @private + * @name init + * @type undefined + */ init: function(){ jQuery.initDone = true; @@ -717,11 +743,9 @@ jQuery.extend({ return this.pushStack( ret, arguments ); }; }); - - // appendTo, prependTo, beforeTo, afterTo jQuery.each( jQuery.macros.to, function(i,n){ - jQuery.fn[ n + "To" ] = function(){ + jQuery.fn[ i ] = function(){ var a = arguments; return this.each(function(){ for ( var i = 0; i < a.length; i++ ) @@ -755,6 +779,15 @@ jQuery.extend({ }, + /** + * A generic iterator function, which can be used to seemlessly + * iterate over both objects and arrays. + * + * @name $.each + * @param Object obj The object, or array, to iterate over. + * @param Object fn The function that will be executed on every object. + * @type Object + */ each: function( obj, fn, args ) { if ( obj.length == undefined ) for ( var i in obj ) @@ -1423,19 +1456,483 @@ new function() { }; jQuery.macros = { - to: ["append","prepend","before","after"], + to: { + /** + * Append all of the matched elements to another, specified, set of elements. + * This operation is, essentially, the reverse of doing a regular + * $(A).append(B), in that instead of appending B to A, you're appending + * A to B. + * + * @example $("p").appendTo("#foo"); + * @before

I would like to say:

+ * @result

I would like to say:

+ * + * @name appendTo + * @type jQuery + * @param String expr A jQuery expression of elements to match. + */ + append: "appendTo", + + /** + * Prepend all of the matched elements to another, specified, set of elements. + * This operation is, essentially, the reverse of doing a regular + * $(A).prepend(B), in that instead of prepending B to A, you're prepending + * A to B. + * + * @example $("p").prependTo("#foo"); + * @before

I would like to say:

Hello
+ * @result

I would like to say:

Hello
+ * + * @name prependTo + * @type jQuery + * @param String expr A jQuery expression of elements to match. + */ + prepend: "prependTo", + + /** + * Insert all of the matched elements before another, specified, set of elements. + * This operation is, essentially, the reverse of doing a regular + * $(A).before(B), in that instead of inserting B before A, you're inserting + * A before B. + * + * @example $("p").insertBefore("#foo"); + * @before
Hello

I would like to say:

+ * @result

I would like to say:

Hello
+ * + * @name insertBefore + * @type jQuery + * @param String expr A jQuery expression of elements to match. + */ + before: "insertBefore", + + /** + * Insert all of the matched elements after another, specified, set of elements. + * This operation is, essentially, the reverse of doing a regular + * $(A).after(B), in that instead of inserting B after A, you're inserting + * A after B. + * + * @example $("p").insertAfter("#foo"); + * @before

I would like to say:

Hello
+ * @result
Hello

I would like to say:

+ * + * @name insertAfter + * @type jQuery + * @param String expr A jQuery expression of elements to match. + */ + after: "insertAfter" + }, + + /** + * Get the current CSS width of the first matched element. + * + * @example $("p").width(); + * @before

This is just a test.

+ * @result "300px" + * + * @name width + * @type String + */ + + /** + * Set the CSS width of every matched element. Be sure to include + * the "px" (or other unit of measurement) after the number that you + * specify, otherwise you might get strange results. + * + * @example $("p").width("20px"); + * @before

This is just a test.

+ * @result

This is just a test.

+ * + * @name width + * @type jQuery + * @param String val Set the CSS property to the specified value. + */ + + /** + * Get the current CSS height of the first matched element. + * + * @example $("p").height(); + * @before

This is just a test.

+ * @result "14px" + * + * @name height + * @type String + */ + + /** + * Set the CSS height of every matched element. Be sure to include + * the "px" (or other unit of measurement) after the number that you + * specify, otherwise you might get strange results. + * + * @example $("p").height("20px"); + * @before

This is just a test.

+ * @result

This is just a test.

+ * + * @name height + * @type jQuery + * @param String val Set the CSS property to the specified value. + */ + + /** + * Get the current CSS top of the first matched element. + * + * @example $("p").top(); + * @before

This is just a test.

+ * @result "0px" + * + * @name top + * @type String + */ + + /** + * Set the CSS top of every matched element. Be sure to include + * the "px" (or other unit of measurement) after the number that you + * specify, otherwise you might get strange results. + * + * @example $("p").top("20px"); + * @before

This is just a test.

+ * @result

This is just a test.

+ * + * @name top + * @type jQuery + * @param String val Set the CSS property to the specified value. + */ + + /** + * Get the current CSS left of the first matched element. + * + * @example $("p").left(); + * @before

This is just a test.

+ * @result "0px" + * + * @name left + * @type String + */ + + /** + * Set the CSS left of every matched element. Be sure to include + * the "px" (or other unit of measurement) after the number that you + * specify, otherwise you might get strange results. + * + * @example $("p").left("20px"); + * @before

This is just a test.

+ * @result

This is just a test.

+ * + * @name left + * @type jQuery + * @param String val Set the CSS property to the specified value. + */ + + /** + * Get the current CSS position of the first matched element. + * + * @example $("p").position(); + * @before

This is just a test.

+ * @result "static" + * + * @name position + * @type String + */ + + /** + * Set the CSS position of every matched element. + * + * @example $("p").position("relative"); + * @before

This is just a test.

+ * @result

This is just a test.

+ * + * @name position + * @type jQuery + * @param String val Set the CSS property to the specified value. + */ + + /** + * Get the current CSS float of the first matched element. + * + * @example $("p").float(); + * @before

This is just a test.

+ * @result "none" + * + * @name float + * @type String + */ + + /** + * Set the CSS float of every matched element. + * + * @example $("p").float("left"); + * @before

This is just a test.

+ * @result

This is just a test.

+ * + * @name float + * @type jQuery + * @param String val Set the CSS property to the specified value. + */ + + /** + * Get the current CSS overflow of the first matched element. + * + * @example $("p").overflow(); + * @before

This is just a test.

+ * @result "none" + * + * @name overflow + * @type String + */ + + /** + * Set the CSS overflow of every matched element. + * + * @example $("p").overflow("auto"); + * @before

This is just a test.

+ * @result

This is just a test.

+ * + * @name overflow + * @type jQuery + * @param String val Set the CSS property to the specified value. + */ + + /** + * Get the current CSS color of the first matched element. + * + * @example $("p").color(); + * @before

This is just a test.

+ * @result "black" + * + * @name color + * @type String + */ + + /** + * Set the CSS color of every matched element. + * + * @example $("p").color("blue"); + * @before

This is just a test.

+ * @result

This is just a test.

+ * + * @name color + * @type jQuery + * @param String val Set the CSS property to the specified value. + */ + + /** + * Get the current CSS background of the first matched element. + * + * @example $("p").background(); + * @before

This is just a test.

+ * @result "" + * + * @name background + * @type String + */ + + /** + * Set the CSS background of every matched element. + * + * @example $("p").background("blue"); + * @before

This is just a test.

+ * @result

This is just a test.

+ * + * @name background + * @type jQuery + * @param String val Set the CSS property to the specified value. + */ + css: "width,height,top,left,position,float,overflow,color,background".split(","), + attr: { + /** + * Get the current value of the first matched element. + * + * @example $("input").val(); + * @before + * @result "some text" + * + * @name val + * @type String + */ + + /** + * Set the value of every matched element. + * + * @example $("input").value("test"); + * @before + * @result + * + * @name val + * @type jQuery + * @param String val Set the property to the specified value. + */ val: "value", + + /** + * Get the html contents of the first matched element. + * + * @example $("div").html(); + * @before
+ * @result + * + * @name html + * @type String + */ + + /** + * Set the html contents of every matched element. + * + * @example $("div").html("new stuff"); + * @before
+ * @result
new stuff + * + * @name html + * @type jQuery + * @param String val Set the html contents to the specified value. + */ html: "innerHTML", - value: null, + + /** + * Get the current id of the first matched element. + * + * @example $("input").id(); + * @before + * @result "test" + * + * @name id + * @type String + */ + + /** + * Set the id of every matched element. + * + * @example $("input").id("newid"); + * @before + * @result + * + * @name id + * @type jQuery + * @param String val Set the property to the specified value. + */ id: null, + + /** + * Get the current title of the first matched element. + * + * @example $("img").title(); + * @before + * @result "my image" + * + * @name title + * @type String + */ + + /** + * Set the title of every matched element. + * + * @example $("img").title("new title"); + * @before + * @result + * + * @name title + * @type jQuery + * @param String val Set the property to the specified value. + */ title: null, + + /** + * Get the current name of the first matched element. + * + * @example $("input").name(); + * @before + * @result "username" + * + * @name name + * @type String + */ + + /** + * Set the name of every matched element. + * + * @example $("input").name("user"); + * @before + * @result + * + * @name name + * @type jQuery + * @param String val Set the property to the specified value. + */ name: null, + + /** + * Get the current href of the first matched element. + * + * @example $("a").href(); + * @before my link + * @result "test.html" + * + * @name href + * @type String + */ + + /** + * Set the href of every matched element. + * + * @example $("a").href("test2.html"); + * @before my link + * @result my link + * + * @name href + * @type jQuery + * @param String val Set the property to the specified value. + */ href: null, + + /** + * Get the current src of the first matched element. + * + * @example $("img").src(); + * @before + * @result "test.jpg" + * + * @name src + * @type String + */ + + /** + * Set the src of every matched element. + * + * @example $("img").src("test2.jpg"); + * @before + * @result + * + * @name src + * @type jQuery + * @param String val Set the property to the specified value. + */ src: null, + + /** + * Get the current rel of the first matched element. + * + * @example $("a").rel(); + * @before my link + * @result "nofollow" + * + * @name rel + * @type String + */ + + /** + * Set the rel of every matched element. + * + * @example $("a").rel("nofollow"); + * @before my link + * @result my link + * + * @name rel + * @type jQuery + * @param String val Set the property to the specified value. + */ rel: null }, + axis: { /** * Get a set of elements containing the unique parents of the matched @@ -1490,7 +1987,28 @@ jQuery.macros = { ancestors: jQuery.parents, /** - * A synonym for ancestors + * Get a set of elements containing the unique ancestors of the matched + * set of elements. + * + * @example $("span").ancestors() + * @before

Hello

Hello Again
+ * @result [ ...,
...
,

Hello

] + * + * @name parents + * @type jQuery + */ + + /** + * Get a set of elements containing the unique ancestors of the matched + * set of elements, and filtered by an expression. + * + * @example $("span").ancestors("p") + * @before

Hello

Hello Again
+ * @result [

Hello

] + * + * @name parents + * @type jQuery + * @param String expr An expression to filter the ancestors with */ parents: jQuery.parents, @@ -1544,7 +2062,7 @@ jQuery.macros = { * * It only returns the immediately previous sibling, not all previous siblings. * - * @example $("p").previous("selected") + * @example $("p").previous(".selected") * @before
Hello

Hello Again

And Again

* @result [
Hello
] * @@ -1570,7 +2088,7 @@ jQuery.macros = { * Get a set of elements containing all of the unique siblings of each of the * matched set of elements, and filtered by an expression. * - * @example $("div").siblings("selected") + * @example $("div").siblings(".selected") * @before
Hello

Hello Again

And Again

* @result [

Hello Again

] * @@ -1578,7 +2096,34 @@ jQuery.macros = { * @type jQuery * @param String expr An expression to filter the sibling Elements with */ - siblings: jQuery.sibling + siblings: jQuery.sibling, + + + /** + * Get a set of elements containing all of the unique children of each of the + * matched set of elements. + * + * @example $("div").children() + * @before

Hello

Hello Again

And Again

+ * @result [ Hello Again ] + * + * @name children + * @type jQuery + */ + + /** + * Get a set of elements containing all of the unique siblings of each of the + * matched set of elements, and filtered by an expression. + * + * @example $("div").children(".selected") + * @before
Hello

Hello Again

And Again

+ * @result [

Hello Again

] + * + * @name children + * @type jQuery + * @param String expr An expression to filter the child Elements with + */ + children: "a.childNodes" }, each: { @@ -1734,12 +2279,12 @@ jQuery.macros = { }, /** - * The opposite of bind. Removes a bound event from each of a set of matched + * The opposite of bind, removes a bound event from each of the matched * elements. You must pass the identical function that was used in the original * bind method. * * @example $("p").unbind( "click", function() { alert("Hello"); } ) - * @before

Hello

+ * @before

Hello

* @result [

Hello

] * * @name unbind @@ -1747,20 +2292,44 @@ jQuery.macros = { * @param String type An event type * @param Function fn A function to unbind from the event on each of the set of matched elements */ + + /** + * Removes all bound events of a particular type from each of the matched + * elements. + * + * @example $("p").unbind( "click" ) + * @before

Hello

+ * @result [

Hello

] + * + * @name unbind + * @type jQuery + * @param String type An event type + */ + + /** + * Removes all bound events from each of the matched elements. + * + * @example $("p").unbind() + * @before

Hello

+ * @result [

Hello

] + * + * @name unbind + * @type jQuery + */ unbind: function( type, fn ) { jQuery.event.remove( this, type, fn ); }, /** - * Trigger a particular event. + * Trigger a type of event on every matched element. * * @example $("p").trigger("click") - * @before

Hello

- * @result [

Hello

] + * @before

Hello

+ * @result alert('hello') * * @name trigger * @type jQuery - * @param String type An event type + * @param String type An event type to trigger. */ trigger: function( type, data ) { jQuery.event.trigger( type, data, this ); -- 1.7.10.4