On Thursday, March 28, 2013 8:08:14 PM UTC+1, tomsn wrote:
>
> Hallo,
>
> within my GWT Application I try to execute the following method:
>
> @Override
> public native void drawChart(Element parent)/*-{
> var series = [{
> data: [ { x: 0, y: 40 }, { x: 1, y: 49 } ],
> color: 'steelblue',
> name: 'Dataset_1'
> }];
> var graph = new $wnd.Rickshaw.Graph( {
> element: parent,
> width: 600,
> height: 200,
> series: series,
> renderer: 'bar'
> });
> graph.render();
> }-*/;
>
> The series array initialized at the beginning of the implementation is
> passed to the Rickshaw.Graph constructor.
> The Rickshaw module tests whether the input object *series *is of *type
> Array* and - *fails*.
>
> if (!(series instanceof Array)) throw ....
>
> I have no explanation for that behavior. I thought it's native JavaScript
> code, executed within the browser, so that there should be
> no difference. But indeed, the array created in the method above does not
> pass that instanceof check.
>
>
GWT code runs in an iframe, so its Array is not the same as the Array in
$wnd, which is why "instanceof Array" fails.
Rickshaw.Graph is simply broken.
See
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray
and
http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.