From ecddb56bc11794118c339134209af8d69ec7a31f Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Tue, 3 Nov 2015 03:07:52 +0100 Subject: [PATCH] Fix for multiple consequent spaces present in CSS selectors, fixes #2670 --- src/lib/css-parse.html | 2 ++ test/unit/css-parse.html | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/lib/css-parse.html b/src/lib/css-parse.html index 332857348e..74e4dd072c 100644 --- a/src/lib/css-parse.html +++ b/src/lib/css-parse.html @@ -60,6 +60,7 @@ if (node.parent) { var ss = node.previous ? node.previous.end : node.parent.start; t = text.substring(ss, node.start-1); + t = t.replace(this._rx.multipleSpaces, ' '); // TODO(sorvell): ad hoc; make selector include only after last ; // helps with mixin syntax t = t.substring(t.lastIndexOf(';')+1); @@ -162,6 +163,7 @@ mixinApply: /@apply[\s]*\([^)]*?\)[\s]*(?:[;\n]|$)?/gim, varApply: /[^;:]*?:[^;]*var[^;]*(?:[;\n]|$)?/gim, keyframesRule: /^@[^\s]*keyframes/, + multipleSpaces: /\s+/g }, VAR_START: '--', diff --git a/test/unit/css-parse.html b/test/unit/css-parse.html index 36172ae7ef..39d6444b08 100644 --- a/test/unit/css-parse.html +++ b/test/unit/css-parse.html @@ -60,6 +60,15 @@ } /* comment */ + +