[Seaside] Problem with JSScript vs JSObject

Jupiter Jones jupiter.jones at mail.com
Fri Jan 13 23:25:07 UTC 2017


What actual javascript ends up at the client and where is it located? Is the error it’s reporting correct?

This may be off base, but perhaps the script generator is adding the JSScript to the onLoad statements and referencing the div, whereas the JSObject is being placed in the div tags script attribute.

I’m just wondering what the “$” mentioned in the error is referring to.

> On 14 Jan 2017, at 8:58 am, Mariano Martinez Peck <marianopeck at gmail.com> wrote:
> 
> Hi guys, 
> 
> Maybe it is because it's already Friday afternoon but I am failing to see something obvious probably.
> 
> I render a div this way:
> 
> html div
> 	id: self chartId;
> 	class: 'researchChartComponentChartContainer';
> 	script: (chart wholeScriptOn: html).	
> 
> And the method #wholeScriptOn: does:
> 
> wholeScriptOn: html
> 
> 	| script chart  |
> 	script := JSScript new.
> 	chart := self makeChartOn: html.
> 	script << chart.
> 	^ script
> 
> The method #makeChartOn:   answers an instance of Highstock (subclass of JSObject). 
> 
> If I let the code as above, I get a client side error:
> 
> VM4229:1 Uncaught SyntaxError: Unexpected token $ in JSON at position 0
> 
> However...if I change wholeScriptOn: to be:
> 
> wholeScriptOn: html
> 
> 	^ self makeChartOn: html
> 
> It works. 
> 
> So...what the hell is going on? As an instance of Highstock it works but as a JSScript it doesn't? 
> They even seem to print the same #asJavascript.
> 
> Any idea?
> 
> Thanks in advance,
> 
> 
> -- 
> Mariano
> http://marianopeck.wordpress.com <http://marianopeck.wordpress.com/>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20170114/8471344e/attachment-0001.html>


More information about the seaside mailing list