+ toggleClass: function(c) {
+ return this.each(function(){
+ if (jQuery.hasWord(this,c))
+ jQuery.className.remove(this,c);
+ else
+ jQuery.className.add(this,c);
+ });
+ },
+ remove: function() {
+ return this.each(function(){
+ this.parentNode.removeChild( this );
+ });
+ },
+
+ 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() {
+ var clone = this.size() > 1;
+ var a = jQuery.clean(arguments);
+ return this.domManip(function(){
+ for ( var i = 0; i < a.length; i++ )
+ this.appendChild( clone ? a[i].cloneNode(true) : a[i] );
+ });
+ },
+
+ appendTo: function() {
+ var a = arguments;
+ return this.each(function(){
+ for ( var i = 0; i < a.length; i++ )
+ $(a[i]).append( this );
+ });
+ },
+
+ prepend: function() {
+ var clone = this.size() > 1;
+ var a = jQuery.clean(arguments);
+ return this.domManip(function(){
+ for ( var i = a.length - 1; i >= 0; i-- )
+ this.insertBefore( clone ? a[i].cloneNode(true) : a[i], this.firstChild );
+ });
+ },
+
+ before: function() {
+ var clone = this.size() > 1;
+ var a = jQuery.clean(arguments);
+ return this.each(function(){
+ for ( var i = 0; i < a.length; i++ )
+ this.parentNode.insertBefore( clone ? a[i].cloneNode(true) : a[i], this );
+ });
+ },
+
+ after: function() {
+ var clone = this.size() > 1;
+ var a = jQuery.clean(arguments);
+ return this.each(function(){
+ for ( var i = a.length - 1; i >= 0; i-- )
+ this.parentNode.insertBefore( clone ? a[i].cloneNode(true) : a[i], this.nextSibling );
+ });
+ },
+
+ empty: function() {
+ return this.each(function(){
+ while ( this.firstChild )
+ this.removeChild( this.firstChild );
+ });
+ },
+
+ bind: function(t,f) {
+ return this.each(function(){jQuery.event.add(this,t,f);});
+ },
+ unbind: function(t,f) {
+ return this.each(function(){jQuery.event.remove(this,t,f);});
+ },
+ trigger: function(t) {
+ return this.each(function(){jQuery.event.trigger(this,t);});
+ },
+
+ pushStack: function(a) {
+ if ( !this.stack ) this.stack = [];
+ this.stack.unshift( this.cur );
+ if ( a ) this.cur = a;
+ return this;
+ },
+
+ find: function(t) {
+ var ret = [];
+ this.each(function(){
+ ret = jQuery.merge( ret, jQuery.Select(t,this) );
+ });
+ this.pushStack( ret );
+ return this;
+ },
+
+ end: function() {
+ this.cur = this.stack.shift();
+ return this;
+ },
+
+ parent: function(a) {
+ var ret = jQuery.map(this.cur,"a.parentNode");
+ if ( a ) ret = jQuery.filter(a,ret).r;
+ return this.pushStack(ret);
+ },
+
+ parents: function(a) {
+ var ret = jQuery.map(this.cur,jQuery.parents);
+ if ( a ) ret = jQuery.filter(a,ret).r;
+ return this.pushStack(ret);
+ },
+
+ siblings: function(a) {
+ // Incorrect, need to exclude current element
+ var ret = jQuery.map(this.cur,jQuery.sibling);
+ if ( a ) ret = jQuery.filter(a,ret).r;
+ return this.pushStack(ret);
+ },
+
+ filter: function(t) {
+ if ( /,/.test(t) ) {
+ var p = t.split(/\s*,\s*/);
+ return this.pushStack( $.map(this.cur,function(a){
+ for ( var i = 0; i < p.length; i++ )
+ if ( jQuery.filter(p[i],[a]).r.length )
+ return a;
+ }) );
+ } else
+ return this.pushStack( jQuery.filter(t,this.cur).r );
+ },
+ not: function(t) {
+ return this.pushStack( t.constructor == String ?
+ jQuery.filter(t,this.cur,false).r :
+ jQuery.grep(this.cur,function(a){ return a != t; }) );
+ },
+ add: function(t) {
+ return this.pushStack( jQuery.merge( this.cur, t.constructor == String ?
+ jQuery.Select(t) : t.constructor == Array ? t : [t] ) );
+ },
+
+ /**
+ * 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.
+ *
+ * @member jQuery
+ * @param {String} expr The expression with which to filter
+ * @type Boolean
+ */
+ is: function(expr) {
+ return jQuery.filter(expr,this.cur).r.length > 0;
+ },
+
+ /**
+ * 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(fn){
+ return this.each(function(){
+ var obj = this;
+
+ if ( this.nodeName == "TABLE" ) {
+ var tbody = this.getElementsByTagName("tbody");
+
+ if ( !tbody.length ) {
+ obj = document.createElement("tbody");
+ this.appendChild( obj );
+ } else
+ obj = tbody[0];
+ }
+
+ fn.apply( obj );
+ });
+ }
+};