>  Mootools:
> includes a hasClass() function:

> Prototype:
> includes a hasClassName() function:



Someone correct me if I'm wrong, but jQuery does have a "hasClass" method...
it's just called "filter" ... and far more powerful because you can use any
jQuery expression (not just classes).

$('p').filter('.intro')...
$('p').filter('.intro:visible')...

There is also the opposite "not" method...

$('p').not('.intro')...

I don't think I'd ever use "hasClass" as long as "filter" was around...
unless there were performance benefits to targeting class more specifically
with hasClass. I do find myself coding if( $('p')[0] ) sometimes have
wondered if there is (or will be) something more explicit (for those
unfamiliar with jQuery) but then I usually add a comment '// check to see if
element exists' and just move on.

Brian.

Reply via email to