Thanks James.

In the example i was considering an 'a' element with one of its
parents with class myClass. If the filter isn't meant to work that way
i guess i will have to use the $() function instead.


But then again, if the filters only apply to the element, why does it
filter nothing regardless of the filter if it contains spaces ?.
Shouldn't the filter return nothing if the expression cannot be
evaluated ?(fail safe rather than silently)


On 26 Sep, 23:56, James Dempster <[EMAIL PROTECTED]> wrote:
> Thefilteryou 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 thinkfilterwill 
> 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 thefilterfunction.
>
> > If you usefilterwith 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