It was a joke! :d Mootools provides access directly to all the Element
methods via the prototype and you never have to retrieve the dom
instance with $. It's just fun to think about it.

On 11 nov, 04:11, Mr Speaker <mrspea...@gmail.com> wrote:
> BTW, just to be clear: there shouldn't EVER be a reason ever to do: $($
> (el).parents('div').get(0)).addClass('blah')
>
> You'd just be getting all the parent divs, asking for their actual DOM
> references (for no reason) then re-wrapping them into jQuery objects
> before adding classes to them!
>
> On Nov 11, 1:12 am, Savageman <savagema...@gmail.com> wrote:
>
>
>
> > Maybe $($(el).parents('div').get(0)).addClass() ? :d (ahah, what ugly
> > syntax :d)
>
> > Anyway thanks, topic solved! ;)
>
> > On 10 nov, 15:04, Michel Belleville <michel.bellevi...@gmail.com>
> > wrote:
>
> > > 2009/11/10 Savageman <savagema...@gmail.com>
>
> > > > About .get(0), Firebug keeps telling me: "$(el).parents("div").get
> > > > (0).addClass is not a function"
>
> > > Sorry, I tested with .eq(0) instead of .get(0) which returns the pure DOM
> > > element instead of a jQuery magic-array wrapping the element.
>
> > > > I still find strange (that eventually gonna change :D) to add the
> > > > possibility to match a specified selector in the .parent() method if
> > > > it only applies to the direct parent... I don't really need all the
> > > > parents here, so it may be more efficient having a method that stops
> > > > looping through parents when the one we want is found. I guess I still
> > > > can use .parent().parent().parent() as I know the <div> should be the
> > > > third parent, but that would require change in the javacscript if i
> > > > want to change the HTML structure...
>
> > > If you don't need all the parents, use .parents('div:first') or
> > > .parents('div').eq(0) as you've found out it's the jQuery way.
>
> > > I may even be so bold as to add you might like to try
> > > .closest()<http://docs.jquery.com/Traversing/closest>which is quite
> > > handy to find "the closest matching element this included".
>
> > > Have fun.
>
> > > Michel Belleville

Reply via email to