From 6e57d096cca533ccf255d93bfa1aa04dbb605bab Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 11 Mar 2014 17:30:49 -0700 Subject: [PATCH] clone ruleset before passing it to applyEmbeddedRuleset; fixes #458 since applyEmbeddedRuleset modifies the ruleset in-place, this ensures that those modifications aren't visible to the caller --- src/core/CSSLint.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/CSSLint.js b/src/core/CSSLint.js index 61e41706..9c4f84ba 100644 --- a/src/core/CSSLint.js +++ b/src/core/CSSLint.js @@ -5,7 +5,7 @@ * @extends parserlib.util.EventTarget */ -/* global parserlib, Reporter */ +/* global parserlib, clone, Reporter */ /* exported CSSLint */ var CSSLint = (function(){ @@ -189,6 +189,8 @@ var CSSLint = (function(){ } if (embeddedRuleset.test(text)){ + //defensively copy so that caller's version does not get modified + ruleset = clone(ruleset); ruleset = applyEmbeddedRuleset(text, ruleset); }