mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
prevent invalid JSON string - fixes #240
This commit is contained in:
parent
4e2887e22f
commit
1c7ca962be
@ -74,11 +74,11 @@ $.tablesorter.storage = function(table, key, val){
|
|||||||
// *** get val ***
|
// *** get val ***
|
||||||
if ($.parseJSON){
|
if ($.parseJSON){
|
||||||
if (ls){
|
if (ls){
|
||||||
v = $.parseJSON(localStorage[key]) || {};
|
v = $.parseJSON(localStorage[key] || '') || {};
|
||||||
} else {
|
} else {
|
||||||
k = document.cookie.split(/[;\s|=]/); // cookie
|
k = document.cookie.split(/[;\s|=]/); // cookie
|
||||||
d = $.inArray(key, k) + 1; // add one to get from the key to the value
|
d = $.inArray(key, k) + 1; // add one to get from the key to the value
|
||||||
v = (d !== 0) ? $.parseJSON(k[d]) || {} : {};
|
v = (d !== 0) ? $.parseJSON(k[d] || '') || {} : {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// allow val to be an empty string to
|
// allow val to be an empty string to
|
||||||
|
Loading…
Reference in New Issue
Block a user