[Seaside] JSObject printOn:

Stan Shepherd stan.shepherd414 at gmail.com
Thu Dec 24 00:43:29 UTC 2009

Stan Shepherd wrote:
> Lukas Renggli wrote:
>> Also it makes it possible to use any objects (like strings themselves)
>> can be added as load scripts.
> So would the following be a valid comment for #addLoadScript:?
>  addLoadScript: anObject
> 	"anObject is any object which replies to #printOn: with valid javascript.
> 	usually it will be a JSObject or a string.
> 	example:
> 	html document 
> 		addLoadScript: 'message()'.
> 	will render:
> 	<script type="text/javascript">/*<![CDATA[*/function
> onLoad(){message()}/*]]>*/</script>" 
>         loadScripts := loadScripts copyWith: anObject.
>         ^ anObject
> Cheers,   ...Stan

Along the same lines, 
WAScriptTag>>with: aString 
	self attributes 
		at: 'type'
		ifAbsentPut: [ 'text/javascript' ].
	super with: 
		[ aString isNil ifFalse: [ self document nextPutAll: aString greaseString
] ]

is called by 
WAHtmlCanvas>>script: aBlock
	self script with: aBlock

so the parameter changes from Block to String in the passing. Am I right in
thinking aBlock should be aString?

View this message in context: http://n4.nabble.com/JSObject-printOn-tp976924p978210.html
Sent from the Squeak - Seaside mailing list archive at Nabble.com.

More information about the seaside mailing list