Massive documentation updates, only thing left to do is ajax.js.

This commit is contained in:
John Resig 2006-07-29 04:17:07 +00:00
parent 44e4c188dd
commit ed867fe6f8
3 changed files with 2148 additions and 47 deletions

File diff suppressed because it is too large Load Diff

209
fx/fx.js
View File

@ -4,15 +4,31 @@ jQuery.fn.extend({
_show: jQuery.fn.show, _show: jQuery.fn.show,
/** /**
* The effects module overloads the show method to now allow * Show all matched elements using a graceful animation.
* for a speed to the show operation. What actually happens is * The height, width, and opacity of each of the matched elements
* that the height, width, and opacity to the matched elements * are changed dynamically according to the specified speed.
* are changed dynamically. The only three current speeds are *
* "slow", "normal", and "fast". For example: * @example $("p").show("slow");
* $("p").show("slow"); *
* Note: You should not run the show method on things * @name show
* that are already shown. This can be circumvented by doing this: * @type jQuery
* $("p:hidden").show("slow"); * @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){ show: function(speed,callback){
return speed ? this.animate({ return speed ? this.animate({
@ -24,9 +40,31 @@ jQuery.fn.extend({
_hide: jQuery.fn.hide, _hide: jQuery.fn.hide,
/** /**
* The hide function behaves very similary to the show function, * Hide all matched elements using a graceful animation.
* but is just the opposite. * The height, width, and opacity of each of the matched elements
* $("p:visible").hide("slow"); * 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){ hide: function(speed,callback){
return speed ? this.animate({ return speed ? this.animate({
@ -35,49 +73,170 @@ jQuery.fn.extend({
}, },
/** /**
* This function increases the height and opacity for all matched * Reveal all matched elements by adjusting their height.
* elements. This is very similar to 'show', but does not change * Only the height is adjusted for this animation, causing all matched
* the width - creating a neat sliding effect. * elements to be revealed in a "sliding" manner.
* $("p:hidden").slideDown("slow"); *
* @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){ slideDown: function(speed,callback){
return this.animate({height: "show"}, speed, callback); return this.animate({height: "show"}, speed, callback);
}, },
/** /**
* Just like slideDown, only it hides all matched elements. * Hide all matched elements by adjusting their height.
* $("p:visible").slideUp("slow"); * 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){ slideUp: function(speed,callback){
return this.animate({height: "hide"}, speed, callback); return this.animate({height: "hide"}, speed, callback);
}, },
/** /**
* Adjusts the opacity of all matched elements from a hidden, * Fade in all matched elements by adjusting their opacity.
* to a fully visible, state. * Only the opacity is adjusted for this animation, meaning that
* $("p:hidden").fadeIn("slow"); * 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){ fadeIn: function(speed,callback){
return this.animate({opacity: "show"}, speed, callback); return this.animate({opacity: "show"}, speed, callback);
}, },
/** /**
* Same as fadeIn, but transitions from a visible, to a hidden state. * Fade out all matched elements by adjusting their opacity.
* $("p:visible").fadeOut("slow"); * 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){ fadeOut: function(speed,callback){
return this.animate({opacity: "hide"}, 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){ fadeTo: function(speed,to,callback){
return this.animate({opacity: to}, speed, callback); return this.animate({opacity: to}, speed, callback);
}, },
/** /**
* * @private
*/ */
animate: function(prop,speed,callback) { animate: function(prop,speed,callback) {
return this.queue(function(){ return this.queue(function(){

599
jquery/jquery.js vendored
View File

@ -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) { jQuery.extend = jQuery.fn.extend = function(obj,prop) {
if ( !prop ) { prop = obj; obj = this; } if ( !prop ) { prop = obj; obj = this; }
for ( var i in prop ) obj[i] = prop[i]; for ( var i in prop ) obj[i] = prop[i];
@ -706,6 +725,13 @@ jQuery.extend = jQuery.fn.extend = function(obj,prop) {
}; };
jQuery.extend({ jQuery.extend({
/**
*
*
* @private
* @name init
* @type undefined
*/
init: function(){ init: function(){
jQuery.initDone = true; jQuery.initDone = true;
@ -718,10 +744,8 @@ jQuery.extend({
}; };
}); });
// appendTo, prependTo, beforeTo, afterTo
jQuery.each( jQuery.macros.to, function(i,n){ jQuery.each( jQuery.macros.to, function(i,n){
jQuery.fn[ n + "To" ] = function(){ jQuery.fn[ i ] = function(){
var a = arguments; var a = arguments;
return this.each(function(){ return this.each(function(){
for ( var i = 0; i < a.length; i++ ) 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 ) { each: function( obj, fn, args ) {
if ( obj.length == undefined ) if ( obj.length == undefined )
for ( var i in obj ) for ( var i in obj )
@ -1423,19 +1456,483 @@ new function() {
}; };
jQuery.macros = { 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 <p>I would like to say: </p><div id="foo"></div>
* @result <div id="foo"><p>I would like to say: </p></div>
*
* @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 <p>I would like to say: </p><div id="foo"><b>Hello</b></div>
* @result <div id="foo"><p>I would like to say: </p><b>Hello</b></div>
*
* @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 <div id="foo">Hello</div><p>I would like to say: </p>
* @result <p>I would like to say: </p><div id="foo">Hello</div>
*
* @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 <p>I would like to say: </p><div id="foo">Hello</div>
* @result <div id="foo">Hello</div><p>I would like to say: </p>
*
* @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 <p>This is just a test.</p>
* @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 <p>This is just a test.</p>
* @result <p style="width:20px;">This is just a test.</p>
*
* @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 <p>This is just a test.</p>
* @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 <p>This is just a test.</p>
* @result <p style="height:20px;">This is just a test.</p>
*
* @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 <p>This is just a test.</p>
* @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 <p>This is just a test.</p>
* @result <p style="top:20px;">This is just a test.</p>
*
* @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 <p>This is just a test.</p>
* @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 <p>This is just a test.</p>
* @result <p style="left:20px;">This is just a test.</p>
*
* @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 <p>This is just a test.</p>
* @result "static"
*
* @name position
* @type String
*/
/**
* Set the CSS position of every matched element.
*
* @example $("p").position("relative");
* @before <p>This is just a test.</p>
* @result <p style="position:relative;">This is just a test.</p>
*
* @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 <p>This is just a test.</p>
* @result "none"
*
* @name float
* @type String
*/
/**
* Set the CSS float of every matched element.
*
* @example $("p").float("left");
* @before <p>This is just a test.</p>
* @result <p style="float:left;">This is just a test.</p>
*
* @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 <p>This is just a test.</p>
* @result "none"
*
* @name overflow
* @type String
*/
/**
* Set the CSS overflow of every matched element.
*
* @example $("p").overflow("auto");
* @before <p>This is just a test.</p>
* @result <p style="overflow:auto;">This is just a test.</p>
*
* @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 <p>This is just a test.</p>
* @result "black"
*
* @name color
* @type String
*/
/**
* Set the CSS color of every matched element.
*
* @example $("p").color("blue");
* @before <p>This is just a test.</p>
* @result <p style="color:blue;">This is just a test.</p>
*
* @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 <p>This is just a test.</p>
* @result ""
*
* @name background
* @type String
*/
/**
* Set the CSS background of every matched element.
*
* @example $("p").background("blue");
* @before <p>This is just a test.</p>
* @result <p style="background:blue;">This is just a test.</p>
*
* @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(","), css: "width,height,top,left,position,float,overflow,color,background".split(","),
attr: { attr: {
/**
* Get the current value of the first matched element.
*
* @example $("input").val();
* @before <input type="text" value="some text"/>
* @result "some text"
*
* @name val
* @type String
*/
/**
* Set the value of every matched element.
*
* @example $("input").value("test");
* @before <input type="text" value="some text"/>
* @result <input type="text" value="test"/>
*
* @name val
* @type jQuery
* @param String val Set the property to the specified value.
*/
val: "value", val: "value",
/**
* Get the html contents of the first matched element.
*
* @example $("div").html();
* @before <div><input/></div>
* @result <input/>
*
* @name html
* @type String
*/
/**
* Set the html contents of every matched element.
*
* @example $("div").html("<b>new stuff</b>");
* @before <div><input/></div>
* @result <div><b>new stuff</b</div>
*
* @name html
* @type jQuery
* @param String val Set the html contents to the specified value.
*/
html: "innerHTML", html: "innerHTML",
value: null,
/**
* Get the current id of the first matched element.
*
* @example $("input").id();
* @before <input type="text" id="test" value="some text"/>
* @result "test"
*
* @name id
* @type String
*/
/**
* Set the id of every matched element.
*
* @example $("input").id("newid");
* @before <input type="text" id="test" value="some text"/>
* @result <input type="text" id="newid" value="some text"/>
*
* @name id
* @type jQuery
* @param String val Set the property to the specified value.
*/
id: null, id: null,
/**
* Get the current title of the first matched element.
*
* @example $("img").title();
* @before <img src="test.jpg" title="my image"/>
* @result "my image"
*
* @name title
* @type String
*/
/**
* Set the title of every matched element.
*
* @example $("img").title("new title");
* @before <img src="test.jpg" title="my image"/>
* @result <img src="test.jpg" title="new image"/>
*
* @name title
* @type jQuery
* @param String val Set the property to the specified value.
*/
title: null, title: null,
/**
* Get the current name of the first matched element.
*
* @example $("input").name();
* @before <input type="text" name="username"/>
* @result "username"
*
* @name name
* @type String
*/
/**
* Set the name of every matched element.
*
* @example $("input").name("user");
* @before <input type="text" name="username"/>
* @result <input type="text" name="user"/>
*
* @name name
* @type jQuery
* @param String val Set the property to the specified value.
*/
name: null, name: null,
/**
* Get the current href of the first matched element.
*
* @example $("a").href();
* @before <a href="test.html">my link</a>
* @result "test.html"
*
* @name href
* @type String
*/
/**
* Set the href of every matched element.
*
* @example $("a").href("test2.html");
* @before <a href="test.html">my link</a>
* @result <a href="test2.html">my link</a>
*
* @name href
* @type jQuery
* @param String val Set the property to the specified value.
*/
href: null, href: null,
/**
* Get the current src of the first matched element.
*
* @example $("img").src();
* @before <img src="test.jpg" title="my image"/>
* @result "test.jpg"
*
* @name src
* @type String
*/
/**
* Set the src of every matched element.
*
* @example $("img").src("test2.jpg");
* @before <img src="test.jpg" title="my image"/>
* @result <img src="test2.jpg" title="my image"/>
*
* @name src
* @type jQuery
* @param String val Set the property to the specified value.
*/
src: null, src: null,
/**
* Get the current rel of the first matched element.
*
* @example $("a").rel();
* @before <a href="test.html" rel="nofollow">my link</a>
* @result "nofollow"
*
* @name rel
* @type String
*/
/**
* Set the rel of every matched element.
*
* @example $("a").rel("nofollow");
* @before <a href="test.html">my link</a>
* @result <a href="test.html" rel="nofollow">my link</a>
*
* @name rel
* @type jQuery
* @param String val Set the property to the specified value.
*/
rel: null rel: null
}, },
axis: { axis: {
/** /**
* Get a set of elements containing the unique parents of the matched * Get a set of elements containing the unique parents of the matched
@ -1490,7 +1987,28 @@ jQuery.macros = {
ancestors: jQuery.parents, 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 <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>
* @result [ <body>...</body>, <div>...</div>, <p><span>Hello</span></p> ]
*
* @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 <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>
* @result [ <p><span>Hello</span></p> ]
*
* @name parents
* @type jQuery
* @param String expr An expression to filter the ancestors with
*/ */
parents: jQuery.parents, parents: jQuery.parents,
@ -1544,7 +2062,7 @@ jQuery.macros = {
* *
* It only returns the immediately previous sibling, not all previous siblings. * It only returns the immediately previous sibling, not all previous siblings.
* *
* @example $("p").previous("selected") * @example $("p").previous(".selected")
* @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p> * @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>
* @result [ <div><span>Hello</span></div> ] * @result [ <div><span>Hello</span></div> ]
* *
@ -1570,7 +2088,7 @@ jQuery.macros = {
* Get a set of elements containing all of the unique siblings of each of the * Get a set of elements containing all of the unique siblings of each of the
* matched set of elements, and filtered by an expression. * matched set of elements, and filtered by an expression.
* *
* @example $("div").siblings("selected") * @example $("div").siblings(".selected")
* @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p> * @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>
* @result [ <p class="selected">Hello Again</p> ] * @result [ <p class="selected">Hello Again</p> ]
* *
@ -1578,7 +2096,34 @@ jQuery.macros = {
* @type jQuery * @type jQuery
* @param String expr An expression to filter the sibling Elements with * @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 <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>
* @result [ <span>Hello Again</span> ]
*
* @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 <div><span>Hello</span><p class="selected">Hello Again</p><p>And Again</p></div>
* @result [ <p class="selected">Hello Again</p> ]
*
* @name children
* @type jQuery
* @param String expr An expression to filter the child Elements with
*/
children: "a.childNodes"
}, },
each: { 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 * elements. You must pass the identical function that was used in the original
* bind method. * bind method.
* *
* @example $("p").unbind( "click", function() { alert("Hello"); } ) * @example $("p").unbind( "click", function() { alert("Hello"); } )
* @before <p>Hello</p> * @before <p onclick="alert('Hello');">Hello</p>
* @result [ <p>Hello</p> ] * @result [ <p>Hello</p> ]
* *
* @name unbind * @name unbind
@ -1747,20 +2292,44 @@ jQuery.macros = {
* @param String type An event type * @param String type An event type
* @param Function fn A function to unbind from the event on each of the set of matched elements * @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 <p onclick="alert('Hello');">Hello</p>
* @result [ <p>Hello</p> ]
*
* @name unbind
* @type jQuery
* @param String type An event type
*/
/**
* Removes all bound events from each of the matched elements.
*
* @example $("p").unbind()
* @before <p onclick="alert('Hello');">Hello</p>
* @result [ <p>Hello</p> ]
*
* @name unbind
* @type jQuery
*/
unbind: function( type, fn ) { unbind: function( type, fn ) {
jQuery.event.remove( this, 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") * @example $("p").trigger("click")
* @before <p>Hello</p> * @before <p click="alert('hello')">Hello</p>
* @result [ <p>Hello</p> ] * @result alert('hello')
* *
* @name trigger * @name trigger
* @type jQuery * @type jQuery
* @param String type An event type * @param String type An event type to trigger.
*/ */
trigger: function( type, data ) { trigger: function( type, data ) {
jQuery.event.trigger( type, data, this ); jQuery.event.trigger( type, data, this );