From ae327d4ee16c831e9ef3caa64231e7de20ae9fb0 Mon Sep 17 00:00:00 2001 From: hideheader Date: Thu, 12 Mar 2015 14:28:52 -0400 Subject: [PATCH] Remove `eval` from css-lint Evaluate string token with `RegExp.exec()` instead of `eval()`. --- csslint/csslint.js | 7 +++++-- edit.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/csslint/csslint.js b/csslint/csslint.js index 6a60eb99..98b4bafe 100644 --- a/csslint/csslint.js +++ b/csslint/csslint.js @@ -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); diff --git a/edit.js b/edit.js index 41282c8f..a0570dca 100644 --- a/edit.js +++ b/edit.js @@ -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