[Seaside] Re: Bug? calling javascript function from onComplete:

Lukas Renggli renggli at gmail.com
Tue Jul 22 20:00:39 UTC 2008


I made an experimental commit to the Seaside 2.9 branch:

    Name: Scriptaculous-Core-lr.33
    Author: lr
    Time: 22 July 2008, 9:54:35 pm
    UUID: f85933bb-5d2b-4c52-a33a-5b47e336dc18
    Ancestors: Scriptaculous-Core-lr.32

    - treat strings passed in to event handlers automatically as
verbatim JavaScript code (experimental)

On 7/22/08, Lukas Renggli <renggli at gmail.com> wrote:
> >  > If you put a String there, it is serialized as a String as well. Use
>  >  >
>  >  >    SUStresm on: 'alert("foo")'
>  >
>  > Just curious - would this be the more common usage? Would it make sense to
>  >  have ST strings convert to JS expressions (unquoted)? Should be easy to add
>  >  the quotes if that is what is desired.
>
>
> For me it is the only logical usage. The following Smalltalk objects
>  map to their JavaScript (PrototypeJS) counterparts: Association,
>  Character, Collection, Color, Date, Dictionary, Duration, Interval,
>  Point, String, and UndefinedObject. To complicate things, JavaScript
>  string literals needs a completely different encoding than JavaScript
>  code.
>
>  Now I agree that the introduction of verbatim JavaScript is a bit
>  complicated right now. This could be simplified by adding a converter
>  message to String. I haven't found the perfect name of this message
>  yet, but something along
>
>     String>>asVerbatimJavascript
>         ^ SUStream on: self
>
>  I also agree that putting a String into an event handler does not make
>  sense in any case. This could be resolved by adding something along
>  (all event handler automatically call #asFunction on the event
>  handler):
>
>    String>>asFunction
>         ^ (SUStream on: self) asFunction
>
>  However this would mean that depending on the context where an object
>  is used it gets converted to something else. I don't know if this is
>  good or bad? Up to now I decided against doing it, but since
>  discussion came up it is maybe time to change? What do you think?
>
>
>  Lukas
>
>
>  --
>  Lukas Renggli
>  http://www.lukas-renggli.ch
>


-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list