Re: how to render access to a JS argument variable?

Johan Brichau <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Hi Chris,

You are right, I was looking at the wrong places and responded too quickly.

> It seems like if the replaceWith: were implemented as:
> 
>     self call 'replaceWith' with: aRenderable
> 
> then maybe they could support all the argument variations specified at
> api.jquery.com, and not only the String variations.

True, but that will break the most common use of those methods: passing in a Smalltalk block or a Seaside component (i.e. any Renderable).

Somehow, your use case has never popped up before, but it’s interesting to see if we could make that work.
The JSObject>>render:on: is used when the script is actually rendered in the html, so it seems difficult to change it there.

Instead of ommitting the call to #render: from #replaceWith:, I’m guessing a different method needs to be introduced which renders any renderable but does nothing with a JSObject.
We can try...

> And, indeed, the *vast majority* of senders of call:with: simply pass
> the argument directly, thus truly providing merely the syntactic sugar
> and nothing more..  But, for some reason, #after:, #append:, #before:,
> #html:, #prepend:, #replaceWith:, #wrap:, #wrapAll:, #wrapInner: all
> have that (self render: aRenderable) which forces the String arg...


If I understand what you are trying to do in the example snippets, the typical way we would write this in the Seaside binding is like this:

(html jQuery id: buttonId) onClick: (html jQuery ajax script: [:s | s << ((s jQuery id: replacementId) replaceWith: resultWidget) ])

cheers
Johan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.