A big distinction between the two proposals is if DOMElement is not
contained in DOMElementContext:

$(DOMEelement,DOMElementContext).closest("body"); returns $([]);

$(DOMEelement).closest("body",DOMElementContext); returns $("body");

I vote for the 2nd argument.

On Jul 23, 10:27 am, John Resig <jere...@gmail.com> wrote:
> Brandon mentioned making it so that you could do:
>   $(Something, SomeContext).closest("div");
>
> And closest would limit its search to within the context of the original
> $(...).
>
> The problem is that:
>   $(DOMElement, DOMElement)
>
> Doesn't work right now (the context is ignored). Thus, we need to make it
> work. Incidentally, there was a proposal a while back to make
>   $(DOMElement, DOMElementContext)
>
> be roughly equivalent to:
>   $(DOMElement).filter(function(){
>     return $(DOMElementContext).has(this);
>   });
>
> If we were to implement $(DOMElement, DOMElementContext) we would also be
> able to access the DOMElementContext (in .context) inside .closest() -
> giving us the ability to implement
>   $(Something, SomeContext).closest("div");
>
> --John
>
> On Thu, Jul 23, 2009 at 10:20 AM, Jörn Zaefferer <
>
> joern.zaeffe...@googlemail.com> wrote:
>
> > I don't follow. What does "make the above .closest() context change" mean?
>
> > Jörn
>
> > On Thu, Jul 23, 2009 at 5:12 AM, John Resig<jere...@gmail.com> wrote:
>
> > >> Not to mention it would either be broken, or be a complete hack.
>
> > >> $(selector, context); is actually an alias for
> > >> $(context).find(selector); And this.context isn't what was passed to
> > >> context.
>
> > > I remember the case of $(DOMElement, DOMElement) being discussed recently
> > as
> > > an alias for $(DOMElement).has(DOMElement) (which just landed in trunk).
> > We
> > > could actually add this in and gain the ability to make the above
> > .closest()
> > > context change, as well. Win-win!
>
> > > --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