I agree that I'm confused too andand need to look up the documentation
most of the time. But that's fine.
Sometimes I just use getElements('> div') instead of getChildren(),
which is much clearer for me.
On 10 oct, 16:32, Philip Thompson <[email protected]> wrote:
> I think it may come down to personal preference for which one you like. They
> are slightly different, but I personally use inject() and adopt() the most.
> Here's a quick demo using adopt.
>
> http://jsfiddle.net/XXDu3/
>
> getChildren: Only get the "immediate" children/descendants. This is
> theoretically quicker if you only need the immediate children and have lots
> of nested html.
>
> getElements: Get all the descendants, not just the immediate children.
>
> getElement: Get any single descendant (per selector provided).
>
> These get* methods can also use selectors to narrow down your results. Hope
> that clears it up a little.
>
> Happy coding,
> ~Philip
>
>
>
>
>
>
>
>
>
> On Mon, Oct 10, 2011 at 2:43 AM, Blackbird <[email protected]> wrote:
> > Typo error:
> > << "grab()" cannot only take >> should be << "grab()" can only take
>
> > On Oct 10, 9:40 am, Blackbird <[email protected]> wrote:
> > > Hello,
>
> > > I've experienced difficulties using correctly the Element API. DOM
> > > manipulation is a cornerstone of any JS framework, so it's important
> > > that the API is perfect.
>
> > > This is what I found confusing in the few Element functions I've had
> > > to use so far:
>
> > > - "grab()" cannot only take an Element with no child elements.
> > > "adopt()" should instead be used to do such a thing. This is
> > > confusing. To me an element containing child elements is an Element,
> > > and not an Elements. Ideally, "grab()" and "adopt()" would be merged
> > > into a single function that would handle all cases.
>
> > > - "getChildren()" and "getElements()". I still don't understand the
> > > difference. So similarly as above, I'd merge both functions to make
> > > things simpler.
>
> --http://lonestarlightandsound.com/