-
Notifications
You must be signed in to change notification settings - Fork 48
consider using json2 for JSON functionality #3
Comments
|
Strangers input: I had to include JSON2 because of weird parsing behaviors On Sunday, March 3, 2013, David Chelimsky wrote:
|
what are they assigned by? jquery-json? I guess it just feels less risky to me to have the websocket library using either the native apis or polyfill implementations of them. I don't have anything against jquery-json. this just doesn't seem like a class of functionality that needs a jQuery facade. |
@bcm yes - in jquery-json. So if it's already supported by the browser's JS engine, you get that definition. If not, but you include json2 before jquery-websocket, then you'll get json2's defs, which will pass through to the native implementation if present. So you can have this rely on json2 if you choose, but in order for jquery-websocket to rely on json2, we'd force end users to require json2 before jquery-websocket. |
@bcm re: the jquery facade, my suspicion is that's just legacy - i.e. jquery introduced these functions before their other-named-counterparts became standard (and before json2 came to be), so keeping the names as/is is a legacy issue in jquery. Perhaps the best solution here is for jquery-json to def |
@justadropofwater appreciate the issue, but not sure how to solve it from jquery-websocket (per my comments to @bcm). For me (and I think for most), a dependency is not a matter of what it provides, but a matter of module A needing module B in order to work. |
even if jquery-json were to define if jquery-websocket instead called seems like the latter strategy is a little less surprising, gives the developer more choice in the matter and anticipates a world in which all browsers in use support the standard methods natively. or am I still missing something obvious? 🐐 |
@bcm I hadn't considered the fact that we're already requiring jquery-json for this. I'm convinced this is a good direction now. The one risk here is that a developer upgrades without understanding this change, views in a browser that already supports |
@bcm oh - by "direct the user to use a browser which supports them natively" you were covering that case. I'm not sure that's an acceptable outcome for all developers, but it might be the best option. Wanna submit a PR that does that? |
I presume that
$.evalJSON
and$.toJSON
come from https://code.google.com/p/jquery-json/. any thoughts on relying on json2.js from https://github.com/douglascrockford/JSON-js instead (as it's a polyfill for the nativeJSON.stringify
andJSON.parse
methods)?The text was updated successfully, but these errors were encountered: