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 committed by tophf
parent f2ab3897c4
commit af79e803e8

View File

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