gigebyte / cookies

Automatically exported from code.google.com/p/cookies
0 stars 0 forks source link

Setting and getting boolean values is not cross-browser compatible #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps reproduce the problem?
1. Set a Cookie with value "true" (String)
2. Get the cookie, check its type
3. MSIE6,7: String; FF3.6: boolean

Additional problem: MSIE don't expect true as a boolean value with the json
API.

What is the expected result of the above steps?  What do you see instead?
Cookie values with "true" or "false" should return boolean values, and
never strings. At least, the return value should be the same cross-browser.

What version of the following are you using?
  jQuery: 1.4.2
  cookies: 2.2.0

The JSON-API is not included, because we already have jquery and
jquery.json-2.2. Another JSON lib would be bloat.

What browser/version are you using?
Win XP, FF 3.6, MSIE 6 (MSIE 7 tested as well)
What OS/version are you using?
Windows XP

Do you have any additional information to provide?

Original issue reported on code.google.com by rues...@gmail.com on 3 Jun 2010 at 10:23

Attachments:

GoogleCodeExporter commented 9 years ago
The problem of strings which look like JSON encoded values is something I have 
been wanting to fix, and I have an enhancement request to do so in Issue #20

With regards to your use of jquery.json-2.2, I'm sorry to say that if the 
defacto-standard JSON API (stringify, parse) is not present, you will not have 
the capability to use anything other than 
strings.  Many modern browsers are using the API now, and the JSON2.js file 
provides it in browsers which do not.  Even jQuery core is now defaulting to 
using the API when it is present, so 
providing JSON2.js helps jQuery in less desirable browsers.  JSON2.js is what 
is always recommended in the jQuery IRC chan and forums when anyone wants to 
work with JSON.  Any other JSON 
API is, IMO, bloat and any code which uses it should be reworked such that the 
bloat can be removed.

Original comment by auldrid...@gmail.com on 3 Jun 2010 at 12:49

GoogleCodeExporter commented 9 years ago
Thank you for your detailed comment. You have a point there for sure, and I'm 
using
json2.js now, reverting my attached patch.

Thanks a lot!

Original comment by rues...@gmail.com on 4 Jun 2010 at 1:50