From 2a921daaa7a02a73967e51b9e09037f667af5af7 Mon Sep 17 00:00:00 2001 From: John Resig Date: Fri, 1 Sep 2006 06:22:39 +0000 Subject: [PATCH] Documented some more functions. --- src/jquery/jquery.js | 92 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 3 deletions(-) diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 467c074..f7f3997 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -781,6 +781,21 @@ jQuery.fn = jQuery.prototype = { }), arguments ); }, + /** + * Create cloned copies of all matched DOM Elements. This does + * not create a cloned copy of this particular jQuery object, + * instead it creates duplicate copies of all DOM Elements. + * This is useful for moving copies of the elements to another + * location in the DOM. + * + * @example $("b").clone().prependTo("p"); + * @before Hello

, how are you?

+ * @result Hello

Hello, how are you?

+ * + * @name clone + * @type jQuery + * @cat DOM/Manipulation + */ clone: function(deep) { return this.pushStack( jQuery.map( this, function(a){ return a.cloneNode( deep != undefined ? deep : true ); @@ -1502,7 +1517,8 @@ jQuery.extend({ innerHTML: "innerHTML", className: "className", value: "value", - disabled: "disabled" + disabled: "disabled", + checked: "checked" }; if ( fix[name] ) { @@ -2175,8 +2191,8 @@ jQuery.macros = { * Get the current CSS background of the first matched element. * * @example $("p").background(); - * @before

This is just a test.

- * @result "" + * @before

This is just a test.

+ * @result "blue" * * @name background * @type String @@ -2197,6 +2213,64 @@ jQuery.macros = { */ css: "width,height,top,left,position,float,overflow,color,background".split(","), + + /** + * Reduce the set of matched elements to a single element. + * The position of the element in the set of matched elements + * starts at 0 and goes to length - 1. + * + * @example $("p").eq(1) + * @before

This is just a test.

So is this

+ * @result [

So is this

] + * + * @name eq + * @type jQuery + * @param Number pos The index of the element that you wish to limit to. + * @cat Core + */ + + /** + * Reduce the set of matched elements to all elements before a given position. + * The position of the element in the set of matched elements + * starts at 0 and goes to length - 1. + * + * @example $("p").lt(1) + * @before

This is just a test.

So is this

+ * @result [

This is just a test.

] + * + * @name lt + * @type jQuery + * @param Number pos Reduce the set to all elements below this position. + * @cat Core + */ + + /** + * Reduce the set of matched elements to all elements after a given position. + * The position of the element in the set of matched elements + * starts at 0 and goes to length - 1. + * + * @example $("p").gt(0) + * @before

This is just a test.

So is this

+ * @result [

So is this

] + * + * @name gt + * @type jQuery + * @param Number pos Reduce the set to all elements after this position. + * @cat Core + */ + + /** + * Filter the set of elements to those that contain the specified text. + * + * @example $("p").contains("test") + * @before

This is just a test.

So is this

+ * @result [

This is just a test.

] + * + * @name contains + * @type jQuery + * @param String str The string that will be contained within the text of an element. + * @cat DOM/Traversing + */ filter: [ "eq", "lt", "gt", "contains" ], @@ -2627,6 +2701,18 @@ jQuery.macros = { each: { + /** + * Remove an attribute from each of the matched elements. + * + * @example $("input").removeAttr("disabled") + * @before + * @result + * + * @name removeAttr + * @type jQuery + * @param String name The name of the attribute to remove. + * @cat DOM + */ removeAttr: function( key ) { this.removeAttribute( key ); }, -- 1.7.10.4