+ // Return just the object
+ this[num];
+ },
+
+ /**
+ * Execute a function within the context of every matched element.
+ * This means that every time the passed-in function is executed
+ * (which is once for every element matched) the 'this' keyword
+ * points to the specific element.
+ *
+ * Additionally, the function, when executed, is passed a single
+ * argument representing the position of the element in the matched
+ * set.
+ *
+ * @name each
+ * @type jQuery
+ * @param Function fn A function to execute
+ */
+ each: function( fn ) {
+ // Iterate through all of the matched elements
+ for ( var i = 0; i < this.length; i++ )
+
+ // Execute the function within the context of each element
+ fn.apply( this[i], [i] );
+
+ return this;
+ },
+
+ /**
+ * Access a property on the first matched element.
+ * This method makes it easy to retreive a property value
+ * from the first matched element.
+ *
+ * @name attr
+ * @type Object
+ * @param String name The name of the property to access.
+ */
+
+ /**
+ * Set a hash of key/value object properties to all matched elements.
+ * This serves as the best way to set a large number of properties
+ * on all matched elements.
+ *
+ * @name attr
+ * @type jQuery
+ * @param Hash prop A set of key/value pairs to set as object properties.
+ */
+
+ /**
+ * Set a single property to a value, on all matched elements.
+ *
+ * @name attr
+ * @type jQuery
+ * @param String key The name of the property to set.
+ * @param Object value The value to set the property to.
+ */
+ attr: function( key, value ) {
+ // Check to see if we're setting style values
+ return key.constructor != String || value ?
+ this.each(function(){
+ // See if we're setting a hash of styles
+ if ( value == undefined )
+ // Set all the styles
+ for ( var prop in key )
+ jQuery.attr(
+ type ? this.style : this,
+ prop, key[prop]
+ );
+
+ // See if we're setting a single key/value style
+ else
+ jQuery.attr(
+ type ? this.style : this,
+ key, value
+ );
+ }) :
+
+ // Look for the case where we're accessing a style value
+ jQuery[ type || "attr" ]( this[0], key );
+ },
+
+ /**
+ * Access a style property on the first matched element.
+ * This method makes it easy to retreive a style property value
+ * from the first matched element.
+ *
+ * @name css
+ * @type Object
+ * @param String name The name of the property to access.
+ */
+
+ /**
+ * Set a hash of key/value style properties to all matched elements.
+ * This serves as the best way to set a large number of style properties
+ * on all matched elements.
+ *
+ * @name css
+ * @type jQuery
+ * @param Hash prop A set of key/value pairs to set as style properties.
+ */
+
+ /**
+ * Set a single style property to a value, on all matched elements.
+ *
+ * @name css
+ * @type jQuery
+ * @param String key The name of the property to set.
+ * @param Object value The value to set the property to.
+ */
+ css: function( key, value ) {
+ return this.attr( key, value, "css" );
+ },
+
+ /**
+ * Retreive the text contents of all matched elements. The result is
+ * a string that contains the combined text contents of all matched
+ * elements. This method works on both HTML and XML documents.
+ *
+ * @name text
+ * @type String
+ */
+ text: function(e) {
+ e = e || this;
+ var t = "";
+ for ( var j = 0; j < e.length; j++ ) {
+ var r = e[j].childNodes;
+ for ( var i = 0; i < r.length; i++ )
+ t += r[i].nodeType != 1 ?
+ r[i].nodeValue : jQuery.fn.text([ r[i] ]);
+ }
+ return t;
+ },
+
+ /**
+ * Set a single style property to a value, on all matched elements.
+ *
+ * @name wrap
+ * @type jQuery
+ * @any String html A string of HTML, that will be created on the fly and wrapped around the target.
+ * @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
+ */
+ wrap: function() {
+ var a = jQuery.clean(arguments);
+ return this.each(function(){
+ var b = a[0].cloneNode(true);
+ this.parentNode.insertBefore( b, this );
+ while ( b.firstChild )
+ b = b.firstChild;
+ b.appendChild( this );
+ });
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, 1, function(a){
+ this.appendChild( 1 );
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, -1, function(a){
+ this.insertBefore( a, this.firstChild );
+ });
+ },
+
+ before: function() {
+ return this.domManip(arguments, false, 1, function(a){
+ this.parentNode.insertBefore( a, this );
+ });
+ },
+
+ after: function() {
+ return this.domManip(arguments, false, -1, function(a){
+ this.parentNode.insertBefore( a, this.nextSibling );
+ });
+ },
+
+ /**
+ * A wrapper function for each() to be used by append and prepend.
+ * Handles cases where you're trying to modify the inner contents of
+ * a table, when you actually need to work with the tbody.
+ *
+ * @private
+ * @member jQuery
+ * @param {Function} fn The function doing the DOM manipulation.
+ * @type jQuery
+ */
+ domManip: function(args, table, dir, fn){
+ var clone = this.size() > 1;
+ var a = jQuery.clean(args);
+
+ return this.each(function(){
+ var obj = this;
+
+ if ( table && this.nodeName == "TABLE" ) {
+ var tbody = this.getElementsByTagName("tbody");
+
+ if ( !tbody.length ) {
+ obj = document.createElement("tbody");
+ this.appendChild( obj );
+ } else
+ obj = tbody[0];
+ }
+
+ for ( var i = ( dir < 0 ? a.length - 1 : 0 );
+ i != ( dir < 0 ? dir : a.length ); i += dir )
+ fn.apply( obj, [ a[i] ] );
+ });
+ },
+
+ pushStack: function(a,args) {
+ var fn = args && args[args.length-1];
+
+ if ( !fn || fn.constructor != Function ) {
+ if ( !this.stack ) this.stack = [];
+ this.stack.push( this.get() );
+ this.get( a );
+ } else {
+ var old = this.get();
+ this.get( a );
+ if ( fn.constructor == Function )
+ return this.each( fn );
+ this.get( old );
+ }