If JSON.parse is available then definitely use it! I don't mind the use of eval, but only when it is required, most times I see it used in laziness...
Definitely pull! On Fri, Jun 1, 2012 at 5:09 PM, Anis KADRI <[email protected]> wrote: > Not using eval > > On Fri, Jun 1, 2012 at 5:07 PM, Filip Maj <[email protected]> wrote: > > > Some of our implementations (Android, BlackBerry) use eval() to parse > > messages coming from native. I have no problem with eval on its own, > > however, when running cordova.js through certain minifiers it can mess > > stuff up if we use eval sloppily [1]. Example from [1], this from > > Android's JS' exec module: > > > > // If a result was returned > > if (r.length > 0) { > > var v; > > eval("v="+r+";"); > > > > > > Gets minified to this (using Google Closure compiler): > > > > if(h.length>0){eval("v="+h+";");if((void > 0).status===g.callbackStatus.OK){ > > > > > > (void 0! Sweet!) > > > > GitHub user will-quast sent a pull request to the JS [1] and to Android > > (native tweaks regarding returning proper quoted JSON) [2] to fix this > > issue. > > > > Any issues with pulling this in, and while we're at it, adjusting the > > other implementations that are doing the same thing? > > > > [1] https://github.com/apache/incubator-cordova-js/pull/15 > > [2] https://github.com/apache/incubator-cordova-android/pull/26 > > > > > -- @purplecabbage risingj.com
