Replace the regular expression used in Format.JSON with one which is longer,

but apparently more friendly to braindead browsers. This allows Safari 3.1
to parse long JSON strings  (>26k), which was not possible with the previous
regex. r=euzuro (Pullup #1493)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@6801 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-04-07 04:22:35 +00:00
parent e84f3d6181
commit 53fb443819

View File

@@ -95,8 +95,9 @@ OpenLayers.Format.JSON = OpenLayers.Class(OpenLayers.Format, {
* characters.
*/
try {
if(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.
test(json)) {
if (/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
/**
* In the second stage we use the eval function to compile the