Restores warnings on invalid properties.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Fri, 10 Apr 2015 19:24:26 +0000 (20:24 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Sun, 12 Apr 2015 11:15:30 +0000 (12:15 +0100)
lib/selectors/tokenizer.js
lib/utils/extractors.js

index 5fa2c5a..28ff533 100644 (file)
@@ -174,7 +174,7 @@ function tokenize(context) {
         newToken.push(tokenize(context));
 
         if (typeof newToken[2] == 'string')
-          newToken[2] = Extract.properties(newToken[2], context);
+          newToken[2] = Extract.properties(newToken[2], [[trimmedValue]], context);
 
         context.mode = oldMode;
         context.track('}');
@@ -218,7 +218,7 @@ function tokenize(context) {
       context.cursor = nextSpecial + 1;
       context.mode = 'body';
 
-      var body = Extract.properties(tokenize(context), context);
+      var body = Extract.properties(tokenize(context), selectors, context);
 
       context.track('{');
       context.mode = oldMode;
index 1ad6d08..ad0529f 100644 (file)
@@ -3,8 +3,12 @@ var Splitter = require('./splitter');
 var COMMA = ',';
 var FORWARD_SLASH = '/';
 
+function selectorName(value) {
+  return value[0];
+}
+
 var Extractors = {
-  properties: function (string, context) {
+  properties: function (string, selectors, context) {
     var list = [];
     var splitter = new Splitter(/[ ,\/]/);
 
@@ -45,6 +49,11 @@ var Extractors = {
 
       var values = splitter.split(candidate.substring(firstColonAt + 1), true);
 
+      if (values.length == 1 && values[0] === '') {
+        context.outer.warnings.push('Empty property \'' + name + '\' inside \'' + selectors.filter(selectorName).join(',') + '\' selector. Ignoring.');
+        continue;
+      }
+
       for (var j = 0, m = values.length; j < m; j++) {
         var value = values[j];
         var trimmed = value.trim();