hasClass: function( selector ) {
var className = " " + selector + " ";
for ( var i = 0, l = this.length; i < l; i++ ) {
- if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}
}
$contents = $div.contents();
ok( $contents.hasClass("foo"), "Found 'foo' in $contents" );
- ok( $contents.hasClass("undefined"), "Did not find 'undefined' in $contents (correctly)" );
+ ok( !$contents.hasClass("undefined"), "Did not find 'undefined' in $contents (correctly)" );
});