updroid / jquery-jstore

Automatically exported from code.google.com/p/jquery-jstore
1 stars 0 forks source link

prepareForRevival() causes SyntaxError with short strings #44

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am using jStore 2.0 (release candidate r38).

I am encountering an issue with storage on WebKit browsers (I have manually 
selected the WebSQL engine). For simple values that are especially short (my 
examples are "uts" and "lt"), the prepareForRevival() function attempts to 
parse them as JSON. Unfortunately, they are not JSON.

My solution is to modify the prepareForStorage() function so that instead of 
only running JSON.stringify on certain types of values (objects, arrays, etc), 
I now run it on every single value. Now that all values are JSON, I no longer 
trigger SyntaxErrors when prepareForRevival() is called.

An alternative solution would be to modify the regular expression so that these 
short strings are no longer identified as JSON.

Original issue reported on code.google.com by jokeyrh...@gmail.com on 19 Aug 2010 at 5:47