The filter you specified is one rule with two elements described in
it. Being firstly an element with a class attribute containing myClass
with a child anchor element. Maybe you possibly mean a.myClass meaning
an anchor element which has a myClass class attribute? As I think
filter will only apply the rule to the element and not check children
elements.

On Sep 26, 5:21 pm, duff <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have started to use Jquery a couple month ago, and i really love the
> framework.
>
> I am currently working on an event delegation plugin, attaching
> generic event to the document and applying filters to the target
> element to determine if an event should be applied.
>
> I have however noticed some weird behavior for the .is() and .filter()
> function :
>
> I am using the latest jquery version 1.2.1 and am having some troubles
> with the filter function.
>
> If you use filter with an expression containing a space ( '.myClass a'
> for example), nothing is filtered at all.
>
> $('*').filter('.myClass a' );  returns all the nodes on the page.
>
> Is it the expected behaviour ? Is there other ways to efficiently
> check if a given node matches a given rule ?
>
> document.addEventListener('click',
>                                         function(target){
>                                                 if $(target).is('.myClass a'){
>                                                       //do sth
>                                                 }
>                                                 if 
> $(target).is('.myOtherClass a'){
>                                                       //do sth else
>                                                 }
>                                          }
>                                         );
>
> Thanks

Reply via email to