still struggling with the confusing scripting API's

Chris Muller <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <CADTxDUjk3mXoUm_FL2epRqXf4hsrO=FB9Uds3tzsX-XoHZXy-A@mail.gmail.com>
I'm still trying to get my head around "what is the best way to write
javascript in Seaside.  I just spent an entire morning and still
failed to write the simplest expression via an aggregation of
Seaside's JSDecoration's.  This is what I want to render:

       new MyJavascriptObject(document.getElementById("id1"))

Using Seasides various brushes and canvas API, I could not even get
the first two words right.  I tried:

        html script with: (html javascript create access: 'MyJavascriptObject'))
        html script with: (html javascript create add: 'MyJavascriptObject'))
        html script with: (html javascript create alias: 'MyJavascriptObject'))
        html script with: (html javascript create assign: 'MyJavascriptObject'))

None of those produce "new MyJavascriptObject", what am I missing?
Its almost like there is a missing JSDecoration or capability missing
from JSStatement..?

After throwing up my hands with that, I decided to try "hard coding"
the Javascript strings into my Seaside rendering methods:

      html script with: (html javascript script: [ : s | s add: 'new
MyJavascriptObject(document.getElementById("', (aPufDomainComponent
htmlId),'") ])

which produces:

     new MyJavascriptObject(document.getElementById(\"id1\")

So that is pretty much what I want, but see that it is escaping the
quote characters, which makes it hard to read in the browser.  Are
those necessary or is there some way to avoid that?

I wanted to avoid having to put big chunks of hardcoded Javascript
strings into my Smalltalk code.  Any advice is appreciated.

 - Chris

PS -- I think the inconsistency of the API is part of my struggle.
JSObject script: can accept a Block, and WAHtmlCanvas>>#script: SAYS
it takes "aBlock", but that HAS to be wrong, because
WAScriptTag>>#with: ends up writing the Block's "greaseString" to the
stream...

thanks.
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.