[Seaside] Generating javascript again ...

Julian Fitzell julian at beta4.com
Wed Jun 2 18:28:12 CEST 2004


Hm... I'd expect that code to be executed by an onload handler so it 
would get executed after all the page is rendered.

And yes, your assessment of the quoting problem is correct.  We changed 
things so that entities were encoded by default and this is obviously an 
exception case that was missed.  We'd happily take a patch that fixes it.

Julian

Romain Robbes wrote:
> Hi again,
> 
>     After fiddling a bit with javascript, trying to enhance the 
> #autofocus: method, we
> have a little suggestion : some scripts should be written at the very 
> end of the document.
> 
> Example :
> this is our enhanced autofocus method, which focuses the element, and
> makes the window scroll to it :
> 
> autofocus: aBlock
>     id := 1000 atRandom.
>     html cssId: id.
>     aBlock value.
>     
>     html script:
>              'var o = document.getElementById("', id asString, '");
>                         window.scroll(0,o.offsetTop);
>                         o.focus();'
> 
> 
> This does not work with this version, as the offset of the autofocused 
> element
> is still 0 when the script is executed. So we had to do some ugly stuff 
> such
> as storing the script in a variable and writing it later on the stream 
> to make the
> script work correctly.
> 
> Could this be implemented by the framework, with a method such as
> delayedScript:, or just script: ?
> 
> Note that as said on our previous mail, currently scripts are broken 
> since quotes (") are converted to " .
> To get around that we had to implement the #script: method :
> 
> script: script
>     self attributeAt: 'language' put: 'text/javascript'.
>     self openTag: 'script'.
>     self html: script.
>     self closeTag: 'script'.
> 
> Previously this called the doesNotUnderstand: method of 
> WAAbstractHTMLBuilder,
> which writes tags in a default way not suitable for scripts.
> 
>     Cheers,
>         Cyril Bazin & Romain Robbes
> 
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside


More information about the Seaside mailing list