cookie.js when setValue‘s value parameter is false delete entry
This commit is contained in:
parent
bded2f5042
commit
fe36a27b51
|
@ -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;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue