From: Jakub Pawlowicz Date: Fri, 10 Apr 2015 19:24:26 +0000 (+0100) Subject: Restores warnings on invalid properties. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=c93f07a1ef116f6131d4082d9de117f65c182402;p=clean-css.git Restores warnings on invalid properties. --- diff --git a/lib/selectors/tokenizer.js b/lib/selectors/tokenizer.js index 5fa2c5a0..28ff533e 100644 --- a/lib/selectors/tokenizer.js +++ b/lib/selectors/tokenizer.js @@ -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; diff --git a/lib/utils/extractors.js b/lib/utils/extractors.js index 1ad6d08e..ad0529f2 100644 --- a/lib/utils/extractors.js +++ b/lib/utils/extractors.js @@ -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();