X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=4a05ee537f68fb89258929a711ce69dff286f313;hb=d3d7d7ebff2e1fc6a1e8ea9a620a7560ff71ef1a;hp=c8dcdd217799b5061e32ef23e57cbe0b1fce74e6;hpb=32d81db90d6ca32ed41b43cbaea347abb1c86c6e;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index c8dcdd2..4a05ee5 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1227,20 +1227,24 @@ jQuery.extend({ }, className: { + // internal only, use addClass("class") add: function( elem, c ){ jQuery.each( c.split(/\s+/), function(i, cur){ if ( !jQuery.className.has( elem.className, cur ) ) elem.className += ( elem.className ? " " : "" ) + cur; }); }, + // internal only, use removeClass("class") remove: function( elem, c ){ elem.className = c ? jQuery.grep( elem.className.split(/\s+/), function(cur){ return !jQuery.className.has( c, cur ); }).join(' ') : ""; }, - has: function( classes, c ){ - return classes && new RegExp("(^|\\s)" + c + "(\\s|$)").test( classes ); + // internal only, use is(".class") + has: function( t, c ) { + t = t.className || t; + return t && new RegExp("(^|\\s)" + c + "(\\s|$)").test( t ); } }, @@ -1813,9 +1817,9 @@ new function() { */ jQuery.each({ parent: "a.parentNode", - parents: jQuery.parents, - next: "jQuery.nth(a,1,'nextSibling')", - prev: "jQuery.nth(a,1,'previousSibling')", + parents: "jQuery.parents(a)", + next: "jQuery.nth(a,2,'nextSibling')", + prev: "jQuery.nth(a,2,'previousSibling')", siblings: "jQuery.sibling(a.parentNode.firstChild,a)", children: "jQuery.sibling(a.firstChild)" }, function(i,n){