Added test and fixed parents()
[jquery.git] / src / jquery / jquery.js
index c8dcdd2..ee65edb 100644 (file)
@@ -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,7 +1817,7 @@ new function() {
  */
 jQuery.each({
        parent: "a.parentNode",
-       parents: jQuery.parents,
+       parents: "jQuery.parents(a)",
        next: "jQuery.nth(a,1,'nextSibling')",
        prev: "jQuery.nth(a,1,'previousSibling')",
        siblings: "jQuery.sibling(a.parentNode.firstChild,a)",