> I have no specific use case in mind for that particular example. I was
> thinking of the second "closest" argument would act like a break
> statement rather than a search within context.
>
> Still, If the context is used to limit the traversal of the closest
> loop, how would you set the context of raw DOM nodes such that $
> ( event.target ).closest(".foo"); was still useful?


In that case you would do:

$( event.target, someContainer ).closest(".foo");

For example, if you didn't want to go beyond the body you could say:

$( event.target, document.body ).closest(".foo");

or if you don't want to go beyond some specific node (which you would
probably want to cache):

$( event.target, $(".bar")[0] ).closest(".foo");

--John

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to