From 35c89f1b1bd494d02747e6e19411151096f8bbda Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Sun, 1 Nov 2015 05:18:53 +0100 Subject: [PATCH] Fix for BEM-like CSS selectors under media queries, fixes #2639. Small optimization for produced CSS (empty rules produced semicolon before, now empty string). --- src/lib/css-parse.html | 2 +- src/lib/style-properties.html | 2 +- test/unit/custom-style.html | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/lib/css-parse.html b/src/lib/css-parse.html index 332857348e..9bfc0f4c4a 100644 --- a/src/lib/css-parse.html +++ b/src/lib/css-parse.html @@ -123,7 +123,7 @@ }, _hasMixinRules: function(rules) { - return (rules[0].selector.indexOf(this.VAR_START) >= 0); + return rules[0].selector.indexOf(this.VAR_START) === 0; }, removeCustomProps: function(cssText) { diff --git a/src/lib/style-properties.html b/src/lib/style-properties.html index fd3e5e82a6..b007551bd5 100644 --- a/src/lib/style-properties.html +++ b/src/lib/style-properties.html @@ -166,7 +166,7 @@ p || ''; } } - return parts.join(';'); + return parts.filter(function(v) {return v;}).join(';'); }, applyProperties: function(rule, props) { diff --git a/test/unit/custom-style.html b/test/unit/custom-style.html index 98b3eb7140..5cd8ab7bee 100644 --- a/test/unit/custom-style.html +++ b/test/unit/custom-style.html @@ -119,6 +119,18 @@ border: 20px solid blue; } + +
italic
@@ -143,6 +155,7 @@
+