I want to make sure my whole code works and clear from warnings in JSlint. I almost made it to be clean but it seems like docCookies framework have all the warning with JSlint.
i.e:
Unexpected '\' before '.'. Unexpected '\' before '+'.
I can't really find anything wrong with the regex, hope that someone can help me on this.
the docCookies framework that I have been working with is:
docCookies: {
getItem: function(e) {
if (!e) {
return null
}
return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(e).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null
},
setItem: function(e, t, n, a, i, r) {
if (!e || /^(?:expires|max\-age|path|domain|secure)$/i.test(e)) {
return false
}
var o = "";
if (n) {
switch (n.constructor) {
case Number:
o = n === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + n;
break;
case String:
o = "; expires=" + n;
break;
case Date:
o = "; expires=" + n.toUTCString();
break
}
}
document.cookie = encodeURIComponent(e) + "=" + encodeURIComponent(t) + o + (i ? "; domain=" + i : "") + (a ? "; path=" + a : "") + (r ? "; secure" : "");
return true
},
removeItem: function(e, t, n) {
if (!this.hasItem(e)) {
return false
}
document.cookie = encodeURIComponent(e) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (n ? "; domain=" + n : "") + (t ? "; path=" + t : "");
return true
},
hasItem: function(e) {
if (!e) {
return false
}
return new RegExp("(?:^|;\\s*)" + encodeURIComponent(e).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=").test(document.cookie)
},
keys: function() {
var e = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/);
for (var t = e.length, n = 0; n < t; n++) {
e[n] = decodeURIComponent(e[n])
}
return e
}
}
some warnings are like the image below:
Thanks in advance for any help. :)
EDIT: Sorry I forgot to add this for the JS lint setting: JSlint settings
Assume: "a Browser" Tolerate: "This" and "Whitespace mess"