cookie.js when setValue‘s value parameter is false delete entry

This commit is contained in:
Phy 2019-03-13 18:27:33 -04:00
parent bded2f5042
commit fe36a27b51
1 changed files with 8 additions and 3 deletions

View File

@ -22,8 +22,13 @@ var DokuCookie = {
var text = [],
_this = this;
this.init();
val = val + "";
this.data[key] = val;
if (val === false){
delete this.data[key];
}else{
val = val + "";
this.data[key] = val;
}
//save the whole data array
jQuery.each(_this.data, function (key, val) {
@ -42,7 +47,7 @@ var DokuCookie = {
*/
getValue: function(key, def){
this.init();
return key in this.data ? this.data[key] : def;
return this.data.hasOwnProperty(key) ? this.data[key] : def;
},
/**