Sensible approach. But how is the following issue of using "non standard" JSON strings solved :
IE8: JSON.parse("{ 'a':1 }") ---> Syntax Error CHROME: JSON.parse("{ 'a':1 }") ---> OK FF: JSON.parse("{ 'a':1 }") ---> Syntax Error OPERA 10.10: JSON.parse("{ 'a':1 }") ---> Undefined variable JSON SAFARI 4.0.4: JSON.parse("{ 'a':1 }") ---> Syntax Error I suppose John will reply : "...we do not support non standard usage ... " And then I might reply : but CHROME does ? Ad infinitum ... Instead I suggest a more productive approach. I suggest JSON.parse not to be used. (shock?horror!) The good old Function() just works. Even in IE8 : var data = "{ 'a':1 }" ; // or the proper syntax '{ "a" : 1 }' data = (new Function("return " + data))(); Above works in each browser, regardless of the fact that "{ 'a':1 }", is not a proper JSON syntax. Including IE8, FF and SAFARI where JSON.parse("{'a':1}") throws error. Above also works in browsers which have no JSON as a native object, of course. A true "cross browser" solution, indeed. It will even lead to a slightly faster jQuery since one try/catch combo will be removed (currently in ajax.js, arround line 583) Now, one might ask why should jQuery 1.4 support "non-standard" JSON strings? For the same reasons CHROME does, is my answer to that. Thanks for reading ... DBJ On Jan 6, 2:16 pm, John Resig <jere...@gmail.com> wrote: > How are you hitting this issue in jQuery? jQuery never uses > JSON.stringify, only JSON.parse. > > We don't really like overwriting native methods - especially ones that > we don't use - to fix bugs. > > --John > > > > On Wed, Jan 6, 2010 at 12:46 AM, Leeoniya <leeon...@gmail.com> wrote: > > for some reason my github commit comments are not showing up except in > > the RSS feed...so re-posting here. > > > Comment in ff3645e: > > > i've run into a known IE8 issue in the past with its native parser's > > inability to serialize empty values of DOM elements. > > > details here:http://tinyurl.com/m2j294 > > > just a heads up, > > Leon > > > -- > > You received this message because you are subscribed to the Google Groups > > "jQuery Development" group. > > To post to this group, send email to jquery-...@googlegroups.com. > > To unsubscribe from this group, send email to > > jquery-dev+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/jquery-dev?hl=en.
-- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.