[Seaside] Issue with JSScript code generated in a render
Lukas Renggli
renggli at gmail.com
Fri Mar 5 06:11:46 UTC 2010
> FIrst issue after loading the JS-Core-lr.84 was :-
>
> javascriptOn: aStream
> aStream javascript: self asMilliseconds
> Message not Understood -> Duration >> asDuration
That's strange.
> Then I get a :-
>
> MessageNotUnderstood: WAHtmlDocument>>scriptGenerator
The code depends on all the latest Seaside packages. Also you need to
flush the configuration packages and re-register all applications. If
you don't want to go through that procedure you can replace JSStream
class>>#encodeString:on: with the following code. That should also
work in older images:
JSStream class>>#encodeString: aString on: aStream
"Strings have a complicated encoding in Javascript, try to optimize
their serialization."
| char value encoded last |
aStream nextPut: $".
1 to: aString size do: [ :index |
char := aString at: index.
value := char greaseInteger.
value < JavascriptCharacters size
ifFalse: [ aStream nextPut: char ]
ifTrue: [
encoded := JavascriptCharacters at: value + 1.
encoded isString
ifTrue: [ aStream nextPutAll: encoded ]
ifFalse: [
"avoid that browsers mistakenly take the output as a closing tag"
(last = $< and: [ char = $/ ])
ifTrue: [ aStream nextPutAll: '\/' ]
ifFalse: [ aStream nextPut: encoded ] ] ].
last := char ].
aStream nextPut: $"
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch
More information about the seaside
mailing list