You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
I've read your bug report but it seems to be that this is not a bug in jquery.json, nether is it a bug in JSON.stringify of IE8.
The bug is that the 'value' property of new elements really is set to null in IE8 for new elements. It is not JSON.stringify that wrongly converts "" to "null", it is document.createElement behaving differently in IE8.
If you use alert or console.log it will give the same result, it is not related to JSON.stringify or jquery.json.
I suggest you use a wrapper for interacting with elements such as jQuery.
JSON.stringify( '' ); gives the correct result in IE8: '""'
JSON.stringiy( null ); gives the correct result in IE8: 'null'
In IE8 document.createElement("input") is an Element object with a property key 'value' of value null.
From l.giraudel on November 23, 2010 16:37:46
There is a bug in the JSON.stringify() method of some versions of IE8 : cf http://blogs.msdn.com/b/jscript/archive/2009/06/23/serializing-the-value-of-empty-dom-elements-using-native-json-in-ie8.aspx The following assertion is supposed to be true :
JSON.stringify(document.createElement("input").value)==='""'
But in some IE8 versions this assertion is false because JSON.stringify(document.createElement("input").value) returns '"null"'.
I found this bug in in IE8 on Windows Server 2008 but I don't have the bug on Windows 7.
I edited my jquery.json.js file :
Original issue: http://code.google.com/p/jquery-json/issues/detail?id=44
The text was updated successfully, but these errors were encountered: