Wow. Just wow. It never ceases to amaze me how esoteric simple type introspection can be in Javascript :) Yes, we should patch this in, and perhaps as a side-effect encode this (and other?) Javascript type tests into the core module somewhere. I'll create an issue so we don't lose track, and take a stab at a patch momentarily.
On Wed, Mar 11, 2009 at 8:07 PM, Thomas Broyer <[email protected]> wrote: > > From JSONParser.createObject: > } else if (o instanceof Array || o instanceof $wnd.Array) { > // Looks like an Array; wrap as JSONArray. > // NOTE: this test can fail for objects coming from a different > window, > // but we know of no reliable tests to determine if something is > an Array > // in all cases. > return @com.google.gwt.json.client.JSONArray::new(Lcom/google/ > gwt/core/client/JavaScriptObject;)(o); > > > Fortunately, Mark Miller (a Googler!) found a reliable solution: > > Object.prototype.toString.apply(value) === '[object Array]' > > See Doug Crockford's comment: > http://blog.360.yahoo.com/blog-TBPekxc1dLNy5DOloPfzVvFIVOWMB0li?p=916 > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
