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

Sven Van Caekenberghe sven at beta9.be
Sat Jun 5 19:27:19 UTC 2010


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
 


More information about the seaside mailing list