Skip to content

Commit

Permalink
clone ruleset before passing it to applyEmbeddedRuleset; fixes CSSLin…
Browse files Browse the repository at this point in the history
…t#458

since applyEmbeddedRuleset modifies the ruleset in-place,
this ensures that those modifications aren't visible to the caller
  • Loading branch information
cvrebert committed May 10, 2014
1 parent e79c5e7 commit 6e57d09
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/CSSLint.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @extends parserlib.util.EventTarget
*/

/* global parserlib, Reporter */
/* global parserlib, clone, Reporter */
/* exported CSSLint */

var CSSLint = (function(){
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 6e57d09

Please sign in to comment.