Because if you only want the first one getChildren() will return them all
which is why I used getElement() as it will just give you one item 

-----Original Message-----
From: Rajeev J Sebastian [mailto:[email protected]] 
Sent: Tuesday, 1 December 2009 7:37 PM
To: [email protected]
Subject: Re: [Moo] fetch immediate child

On Tue, Dec 1, 2009 at 1:56 PM, אריה גלזר <[email protected]> wrote:
> this will return a child for this scenario as well:
> <div id='one'>
>   <div>
>     <div class='wanted'></div>
>   </div>
> </div>
> $('one').getElement('wanted')
> so its not right.
> i guess this will require some sort of hack. i was thining of something
like
> this (brobably will need to be tested and fixed):
> Element.extend({
>     findImediateChildren : function(match){
>         var temp_class = 'a-very-unlikely-maybe-random-class-name',result;
>         this.addClass(temp_class);
>         result = this.getParent().getElements('.'+temp_class+'>'+match);
>         this.removeClass(temp_class);
>         return result;
>     }
> })
>

WHY ?!?

this.getChildren(selector) works, is in mootools .... use it!

Regards
Rajeev J Sebastian

Reply via email to