Remove eval from css-lint

Evaluate string token with `RegExp.exec()` instead of `eval()`.
This commit is contained in:
hideheader 2015-03-12 14:28:52 -04:00
parent 83bcde6569
commit ae327d4ee1
2 changed files with 6 additions and 3 deletions

View File

@ -4341,9 +4341,12 @@ function PropertyValuePart(text, line, col){
this.type = "function";
this.name = RegExp.$1;
this.value = text;
} else if (/^["'][^"']*["']/.test(text)){ //string
// } else if (/^["'][^"']*["']/.test(text)){ //string
// this.type = "string";
// this.value = eval(text);
} else if (/^(["'])[^\1]*\1/.test(text)){ //string
this.type = "string";
this.value = eval(text);
this.value = /^(["'])([^\1]*)\1/.exec(text)[2];
} else if (Colors[text.toLowerCase()]){ //named color
this.type = "color";
temp = Colors[text.toLowerCase()].substring(1);

View File

@ -329,7 +329,7 @@ window.addEventListener("load", init, false);
function init() {
tE("sections-help", "helpAlt", "alt");
loadPrefs({"smart-indent": "true"});
loadPrefs({"smart-indent": true});
var params = getParams();
if (!params.id) { // match should be 2 - one for the whole thing, one for the parentheses
// This is an add