[Seaside] jQuery: (or JQueryClass>>with:) vs. id:

Lukas Renggli renggli at gmail.com
Sat Jun 5 20:10:51 UTC 2010


The jQuery constructor on the Javascript side takes all kinds of
different arguments that make different things to happen.

    http://api.jquery.com/jQuery/

#jQuery: and #with: try to emulate that to some extent. If you want to
be explicit you should use the more specific constructor methods.

Lukas

On 5 June 2010 21:27, Sven Van Caekenberghe <sven at beta9.be> wrote:
> I got really confused today trying to use the JQuery library to do some simple AJAX update. I was writing my own code based on JQAjaxFunctionalTest. BTW, these self-documenting functional tests are really incredibly awesome.
>
> Instead of the actual example:
>
> html code id: #logger; with: DateAndTime now.
> html submitButton
>        onClick: (html jQuery ajax
>                script: [ :s | s << (s jQuery: #logger) html: DateAndTime now ]);
>        with: 'Replace'
>
> I wrote:
>
> |id|
> id := html nextId.
> html code id: id; with: DateAndTime now.
> html submitButton
>        onClick: (html jQuery ajax
>                script: [ :s | s << (s jQuery: id) html: DateAndTime now ]);
>        with: 'Replace'
>
> And it took me quite some time to figure out that it had to be:
>
> |id|
> id := html nextId.
> html code id: id; with: DateAndTime now.
> html submitButton
>        onClick: (html jQuery ajax
>                script: [ :s | s << (s jQuery id: id) html: DateAndTime now ]);
>        with: 'Replace'
>
> Looking at the implementation of jQuery: and JQueryClass>>with: my first impression is that this could be added, but I probably don't see all the consequences. From an external API standpoint, it would be logical and nice to have.
>
> Sven
>  _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



-- 
Lukas Renggli
www.lukas-renggli.ch


More information about the seaside mailing list