bestiejs / json3

A JSON polyfill. No longer maintained.
https://bestiejs.github.io/json3
Other
1.02k stars 150 forks source link

json.stringify undefined in IE7 #85

Open pkrumins opened 8 years ago

pkrumins commented 8 years ago

Hello there,

Today at Browserling I had to debug an issue for a customer in IE7. He was using socket.io (latest v1.3.7), that uses json3.

I found out that in IE7 json.stringify is undefined, however json.JSON.stringify is defined.

Here's a screenshot from debugger attached to IE7 that shows the problem (it's in socket.io-client.js):

image

I'm not sure if it's json3 issue, or socket.io-client.js issue, but as a workaround I'm simply using json.JSON.stringify in that place. I thought I'd let you know.

P. Krumins

bnjmnt4n commented 8 years ago

Hi, I'm not too sure how socket.io imports JSON3 and uses it, but typically it should be available as JSON.stringify (uppercase, not lowercase). Does that work for you? We also export it as JSON3.stringify too for browsers, unless the socket.io client uses some code compiler like browserify/webpack.

pkrumins commented 8 years ago

The code works in IE8 and newer IEs, it's just it doesn't work in IE7. I'm not familiar how socket.io-client imports JSON3 either. That screenshot is from socket.io-client. Here is that place on github:

https://github.com/socketio/socket.io-client/blob/d125da3c0fb05c9bc958a501b102f73d0e552a72/socket.io.js#L5872

I haven't tested if JSON.stringify works as I found a workaround via json.JSON.stringify for IE7 (I live patched client's socket.io.js.)