Thursday, March 28, 2013

Re: Literal Array Creation in JSNI

On Thursday, March 28, 2013 8:08:14 PM UTC+1, tomsn wrote:

within my GWT Application I try to execute the following method:

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'

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.

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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment