* @property
* @name jquery
* @type String
+ * @cat Core
*/
jquery: "$Rev$",
* @property
* @name length
* @type Number
+ * @cat Core
*/
/**
*
* @name size
* @type Number
+ * @cat Core
*/
size: function() {
return this.length;
*
* @name get
* @type Array<Element>
+ * @cat Core
*/
/**
- * Access a single matched element. <tt>num</tt> is used to access the
- * <tt>num</tt>th element matched.
+ * Access a single matched element. num is used to access the
+ * Nth element matched.
*
* @example $("img").get(1);
* @before <img src="test1.jpg"/> <img src="test2.jpg"/>
*
* @name get
* @type Element
- * @param Number num Access the element in the <tt>num</tt>th position.
+ * @param Number num Access the element in the Nth position.
+ * @cat Core
*/
/**
* @name get
* @type jQuery
* @param Elements elems An array of elements
+ * @cat Core
*/
get: function( num ) {
// Watch for when an array (of elements) is passed in
* @name each
* @type jQuery
* @param Function fn A function to execute
+ * @cat Core
*/
each: function( fn, args ) {
return jQuery.each( this, fn, args );
* @name attr
* @type Object
* @param String name The name of the property to access.
+ * @cat DOM
*/
/**
* @name attr
* @type jQuery
* @param Hash prop A set of key/value pairs to set as object properties.
+ * @cat DOM
*/
/**
* @type jQuery
* @param String key The name of the property to set.
* @param Object value The value to set the property to.
+ * @cat DOM
*/
attr: function( key, value, type ) {
// Check to see if we're setting style values
- return key.constructor != String || value ?
+ return key.constructor != String || value != undefined ?
this.each(function(){
// See if we're setting a hash of styles
if ( value == undefined )
* @name css
* @type Object
* @param String name The name of the property to access.
+ * @cat CSS
*/
/**
* @name css
* @type jQuery
* @param Hash prop A set of key/value pairs to set as style properties.
+ * @cat CSS
*/
/**
* @type jQuery
* @param String key The name of the property to set.
* @param Object value The value to set the property to.
+ * @cat CSS
*/
css: function( key, value ) {
return this.attr( key, value, "curCSS" );
*
* @name text
* @type String
+ * @cat DOM
*/
text: function(e) {
e = e || this;
* @any Element elem A DOM element that will be wrapped.
* @any Array<Element> elems An array of elements, the first of which will be wrapped.
* @any Object obj Any object, converted to a string, then a text node.
+ * @cat DOM/Manipulation
*/
wrap: function() {
// The elements to wrap the target around
/**
* Append any number of elements to the inside of all matched elements.
- * This operation is similar to doing an <tt>appendChild</tt> to all the
+ * This operation is similar to doing an appendChild to all the
* specified elements, adding them into the document.
*
* @example $("p").append("<b>Hello</b>");
* @any Element elem A DOM element that will be appended.
* @any Array<Element> elems An array of elements, all of which will be appended.
* @any Object obj Any object, converted to a string, then a text node.
+ * @cat DOM/Manipulation
*/
append: function() {
return this.domManip(arguments, true, 1, function(a){
* @any Element elem A DOM element that will be prepended.
* @any Array<Element> elems An array of elements, all of which will be prepended.
* @any Object obj Any object, converted to a string, then a text node.
+ * @cat DOM/Manipulation
*/
prepend: function() {
return this.domManip(arguments, true, -1, function(a){
* @any Element elem A DOM element that will beinserted.
* @any Array<Element> elems An array of elements, all of which will be inserted.
* @any Object obj Any object, converted to a string, then a text node.
+ * @cat DOM/Manipulation
*/
before: function() {
return this.domManip(arguments, false, 1, function(a){
* @any Element elem A DOM element that will beinserted.
* @any Array<Element> elems An array of elements, all of which will be inserted.
* @any Object obj Any object, converted to a string, then a text node.
+ * @cat DOM/Manipulation
*/
after: function() {
return this.domManip(arguments, false, -1, function(a){
*
* @name end
* @type jQuery
+ * @cat DOM/Traversing
*/
end: function() {
return this.get( this.stack.pop() );
* @name find
* @type jQuery
* @param String expr An expression to search with.
+ * @cat DOM/Traversing
*/
find: function(t) {
return this.pushStack( jQuery.map( this, function(a){
* @name filter
* @type jQuery
* @param String expr An expression to search with.
+ * @cat DOM/Traversing
*/
/**
* @name filter
* @type jQuery
* @param Array<String> exprs A set of expressions to evaluate against
+ * @cat DOM/Traversing
*/
filter: function(t) {
return this.pushStack(
* @name not
* @type jQuery
* @param Element el An element to remove from the set
+ * @cat DOM/Traversing
*/
/**
* @name not
* @type jQuery
* @param String expr An expression with which to remove matching elements
+ * @cat DOM/Traversing
*/
not: function(t) {
return this.pushStack( t.constructor == String ?
* @name add
* @type jQuery
* @param String expr An expression whose matched elements are added
+ * @cat DOM/Traversing
*/
/**
* @name add
* @type jQuery
* @param Array<Element> els An array of Elements to add
+ * @cat jQuery
*/
/**
* @name add
* @type jQuery
* @param Element el An Element to add
+ * @cat jQuery
*/
add: function(t) {
return this.pushStack( jQuery.merge( this, t.constructor == String ?
* @member jQuery
* @param {String} expr The expression with which to filter
* @type Boolean
+ * @cat jQuery
*/
is: function(expr) {
return expr ? jQuery.filter(expr,this).r.length > 0 : this.length > 0;
* @param Object obj The object to extend
* @param Object prop The object that will be merged into the first.
* @type Object
+ * @cat Javascript
*/
jQuery.extend = jQuery.fn.extend = function(obj,prop) {
if ( !prop ) { prop = obj; obj = this; }
jQuery.fn[ i ] = function(){
var a = arguments;
return this.each(function(){
- for ( var i = 0; i < a.length; i++ )
- $(a[i])[n]( this );
+ for ( var j = 0; j < a.length; j++ )
+ $(a[j])[n]( this );
});
};
});
return this.each( n, arguments );
};
});
+
+ jQuery.each( jQuery.macros.filter, function(i,n){
+ jQuery.fn[ n ] = function(num,fn) {
+ return this.filter( ":" + n + "(" + num + ")", fn );
+ };
+ });
jQuery.each( jQuery.macros.attr, function(i,n){
n = n || i;
* @param Object obj The object, or array, to iterate over.
* @param Object fn The function that will be executed on every object.
* @type Object
+ * @cat Javascript
*/
each: function( obj, fn, args ) {
if ( obj.length == undefined )
* @name appendTo
* @type jQuery
* @param String expr A jQuery expression of elements to match.
+ * @cat DOM/Manipulation
*/
- append: "appendTo",
+ appendTo: "append",
/**
* Prepend all of the matched elements to another, specified, set of elements.
* @name prependTo
* @type jQuery
* @param String expr A jQuery expression of elements to match.
+ * @cat DOM/Manipulation
*/
- prepend: "prependTo",
+ prependTo: "prepend",
/**
* Insert all of the matched elements before another, specified, set of elements.
* @name insertBefore
* @type jQuery
* @param String expr A jQuery expression of elements to match.
+ * @cat DOM/Manipulation
*/
- before: "insertBefore",
+ insertBefore: "before",
/**
* Insert all of the matched elements after another, specified, set of elements.
* @name insertAfter
* @type jQuery
* @param String expr A jQuery expression of elements to match.
+ * @cat DOM/Manipulation
*/
- after: "insertAfter"
+ insertAfter: "after"
},
/**
*
* @name width
* @type String
+ * @cat CSS
*/
/**
* @name width
* @type jQuery
* @param String val Set the CSS property to the specified value.
+ * @cat CSS
*/
/**
*
* @name height
* @type String
+ * @cat CSS
*/
/**
* @name height
* @type jQuery
* @param String val Set the CSS property to the specified value.
+ * @cat CSS
*/
/**
*
* @name top
* @type String
+ * @cat CSS
*/
/**
* @name top
* @type jQuery
* @param String val Set the CSS property to the specified value.
+ * @cat CSS
*/
/**
*
* @name left
* @type String
+ * @cat CSS
*/
/**
* @name left
* @type jQuery
* @param String val Set the CSS property to the specified value.
+ * @cat CSS
*/
/**
*
* @name position
* @type String
+ * @cat CSS
*/
/**
* @name position
* @type jQuery
* @param String val Set the CSS property to the specified value.
+ * @cat CSS
*/
/**
*
* @name float
* @type String
+ * @cat CSS
*/
/**
* @name float
* @type jQuery
* @param String val Set the CSS property to the specified value.
+ * @cat CSS
*/
/**
*
* @name overflow
* @type String
+ * @cat CSS
*/
/**
* @name overflow
* @type jQuery
* @param String val Set the CSS property to the specified value.
+ * @cat CSS
*/
/**
*
* @name color
* @type String
+ * @cat CSS
*/
/**
* @name color
* @type jQuery
* @param String val Set the CSS property to the specified value.
+ * @cat CSS
*/
/**
*
* @name background
* @type String
+ * @cat CSS
*/
/**
* @name background
* @type jQuery
* @param String val Set the CSS property to the specified value.
+ * @cat CSS
*/
css: "width,height,top,left,position,float,overflow,color,background".split(","),
+ filter: [ "eq", "lt", "gt", "contains" ],
+
attr: {
/**
* Get the current value of the first matched element.
*
* @name val
* @type String
+ * @cat DOM/Attributes
*/
/**
* @name val
* @type jQuery
* @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
*/
val: "value",
*
* @name html
* @type String
+ * @cat DOM/Attributes
*/
/**
*
* @example $("div").html("<b>new stuff</b>");
* @before <div><input/></div>
- * @result <div><b>new stuff</b</div>
+ * @result <div><b>new stuff</b></div>
*
* @name html
* @type jQuery
* @param String val Set the html contents to the specified value.
+ * @cat DOM/Attributes
*/
html: "innerHTML",
*
* @name id
* @type String
+ * @cat DOM/Attributes
*/
/**
* @name id
* @type jQuery
* @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
*/
id: null,
*
* @name title
* @type String
+ * @cat DOM/Attributes
*/
/**
* @name title
* @type jQuery
* @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
*/
title: null,
*
* @name name
* @type String
+ * @cat DOM/Attributes
*/
/**
* @name name
* @type jQuery
* @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
*/
name: null,
*
* @name href
* @type String
+ * @cat DOM/Attributes
*/
/**
* @name href
* @type jQuery
* @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
*/
href: null,
*
* @name src
* @type String
+ * @cat DOM/Attributes
*/
/**
* @name src
* @type jQuery
* @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
*/
src: null,
*
* @name rel
* @type String
+ * @cat DOM/Attributes
*/
/**
* @name rel
* @type jQuery
* @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
*/
rel: null
},
*
* @name parent
* @type jQuery
+ * @cat DOM/Traversing
*/
/**
* @name parent
* @type jQuery
* @param String expr An expression to filter the parents with
+ * @cat DOM/Traversing
*/
parent: "a.parentNode",
*
* @name ancestors
* @type jQuery
+ * @cat DOM/Traversing
*/
/**
* @name ancestors
* @type jQuery
* @param String expr An expression to filter the ancestors with
+ * @cat DOM/Traversing
*/
ancestors: jQuery.parents,
*
* @name parents
* @type jQuery
+ * @cat DOM/Traversing
*/
/**
* @name parents
* @type jQuery
* @param String expr An expression to filter the ancestors with
+ * @cat DOM/Traversing
*/
parents: jQuery.parents,
*
* @name next
* @type jQuery
+ * @cat DOM/Traversing
*/
/**
* @name next
* @type jQuery
* @param String expr An expression to filter the next Elements with
+ * @cat DOM/Traversing
*/
next: "jQuery.sibling(a).next",
*
* @name prev
* @type jQuery
+ * @cat DOM/Traversing
*/
/**
* @name prev
* @type jQuery
* @param String expr An expression to filter the previous Elements with
+ * @cat DOM/Traversing
*/
prev: "jQuery.sibling(a).prev",
*
* @name siblings
* @type jQuery
+ * @cat DOM/Traversing
*/
/**
* @name siblings
* @type jQuery
* @param String expr An expression to filter the sibling Elements with
+ * @cat DOM/Traversing
*/
siblings: jQuery.sibling,
*
* @name children
* @type jQuery
+ * @cat DOM/Traversing
*/
/**
- * 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 children of each of the
* matched set of elements, and filtered by an expression.
*
* @example $("div").children(".selected")
* @name children
* @type jQuery
* @param String expr An expression to filter the child Elements with
+ * @cat DOM/Traversing
*/
children: "a.childNodes"
},
*
* @name show
* @type jQuery
+ * @cat Effects
*/
- show: function(){
+ _show: function(){
this.style.display = this.oldblock ? this.oldblock : "";
if ( jQuery.css(this,"display") == "none" )
this.style.display = "block";
*
* @name hide
* @type jQuery
+ * @cat Effects
*/
- hide: function(){
+ _hide: function(){
this.oldblock = this.oldblock || jQuery.css(this,"display");
if ( this.oldblock == "none" )
this.oldblock = "block";
*
* @name toggle
* @type jQuery
+ * @cat Effects
*/
- toggle: function(){
+ _toggle: function(){
var d = jQuery.css(this,"display");
$(this)[ !d || d == "none" ? "show" : "hide" ]();
},
/**
* Adds the specified class to each of the set of matched elements.
*
- * @example ("p").addClass("selected")
+ * @example $("p").addClass("selected")
* @before <p>Hello</p>
* @result [ <p class="selected">Hello</p> ]
*
* @name addClass
* @type jQuery
* @param String class A CSS class to add to the elements
+ * @cat DOM
*/
addClass: function(c){
jQuery.className.add(this,c);
},
/**
- * The opposite of addClass. Removes the specified class from the
- * set of matched elements.
+ * Removes the specified class from the set of matched elements.
*
- * @example ("p").removeClass("selected")
+ * @example $("p").removeClass("selected")
* @before <p class="selected">Hello</p>
* @result [ <p>Hello</p> ]
*
* @name removeClass
* @type jQuery
* @param String class A CSS class to remove from the elements
+ * @cat DOM
*/
removeClass: function(c){
jQuery.className.remove(this,c);
},
/**
- * Adds the specified class if it is present. Remove it if it is
+ * Adds the specified class if it is present, removes it if it is
* not present.
*
- * @example ("p").toggleClass("selected")
+ * @example $("p").toggleClass("selected")
* @before <p>Hello</p><p class="selected">Hello Again</p>
* @result [ <p class="selected">Hello</p>, <p>Hello Again</p> ]
*
* @name toggleClass
* @type jQuery
* @param String class A CSS class with which to toggle the elements
+ * @cat DOM
*/
toggleClass: function( c ){
jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this,c);
},
/**
- * TODO: Document
+ * Removes all matched elements from the DOM. This does NOT remove them from the
+ * jQuery object, allowing you to use the matched elements further.
+ *
+ * @example $("p").remove();
+ * @before <p>Hello</p> how are <p>you?</p>
+ * @result how are
+ *
+ * @name remove
+ * @type jQuery
+ * @cat DOM/Manipulation
+ */
+
+ /**
+ * Removes only elements (out of the list of matched elements) that match
+ * the specified jQuery expression. This does NOT remove them from the
+ * jQuery object, allowing you to use the matched elements further.
+ *
+ * @example $("p").remove(".hello");
+ * @before <p class="hello">Hello</p> how are <p>you?</p>
+ * @result how are <p>you?</p>
+ *
+ * @name remove
+ * @type jQuery
+ * @param String expr A jQuery expression to filter elements by.
+ * @cat DOM/Manipulation
*/
remove: function(a){
if ( !a || jQuery.filter( [this], a ).r )
/**
* Removes all child nodes from the set of matched elements.
*
- * @example ("p").empty()
+ * @example $("p").empty()
* @before <p>Hello, <span>Person</span> <a href="#">and person</a></p>
* @result [ <p></p> ]
*
* @name empty
* @type jQuery
+ * @cat DOM/Manipulation
*/
empty: function(){
while ( this.firstChild )
* @type jQuery
* @param String type An event type
* @param Function fn A function to bind to the event on each of the set of matched elements
+ * @cat Events
*/
bind: function( type, fn ) {
if ( fn.constructor == String )
* @type jQuery
* @param String type An event type
* @param Function fn A function to unbind from the event on each of the set of matched elements
+ * @cat Events
*/
/**
* @name unbind
* @type jQuery
* @param String type An event type
+ * @cat Events
*/
/**
*
* @name unbind
* @type jQuery
+ * @cat Events
*/
unbind: function( type, fn ) {
jQuery.event.remove( this, type, fn );
* @name trigger
* @type jQuery
* @param String type An event type to trigger.
+ * @cat Events
*/
trigger: function( type, data ) {
jQuery.event.trigger( type, data, this );
}
}
-};
\ No newline at end of file
+};