On 11/13/06, .M. <[EMAIL PROTECTED]> wrote:
>
> Hi all
>
> Question on one of Bob's samples from
> http://svn.mochikit.com/presentations/2006/ajax_experience/slides.html
> and code below runs in the interpreter
> http://mochikit.com/examples/interpreter/index.html?input_text=&input_textarea=
>
> How come option 1 (commented out below) doesn't work while option 2
> does?
>
> Is there any way to get logging info on this kind of thing?
>
> items = []
> titles = []
> titles[0] = {'title':'Superman','id':'2'};
> titles[1] = {'title':'Batman','id':'3'};
> for (i in titles) {
>         var url = '/view/title/' + titles[i].id;
>         var text = titles[i].title;
>         //var thisItem =  A({'href':url}, text); // OPTION 1 which doesn't
> work
>         var thisItem = text; // OPTION 2 which works
>         items.push(thisItem);
>         log(items);
> }
>
> appendChildNodes($('multiline'), [UL(null, map(LI, items))] );

It doesn't work because that needs to be map(partial(LI, null),
items). The content must be the *second* parameter to LI, so you can't
use map directly on it like that. Text is allowed to be in the first
parameter as a convenience, but anything else is interpreted as the
attributes object.

-bob

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to