From: Jakub Pawlowicz Date: Fri, 27 Feb 2015 19:48:27 +0000 (+0000) Subject: Fixes #469 - extracting from broken property. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f78d2fbd786978fb8680deffd48f7d47c2e8a82f;p=clean-css.git Fixes #469 - extracting from broken property. That should never happen but skip such properties if ever encountered. --- diff --git a/History.md b/History.md index 4c5ba7e3..493da1fa 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,7 @@ [3.1.1 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.1.0...HEAD) ================== +* Fixed issue [#469](https://github.com/jakubpawlowicz/clean-css/issues/469) - extracting broken property. * Fixed issue [#470](https://github.com/jakubpawlowicz/clean-css/issues/470) - negative padding removal. * Fixed issue [#471](https://github.com/jakubpawlowicz/clean-css/issues/471) - correct order after restructuring. diff --git a/lib/properties/extractor.js b/lib/properties/extractor.js index 418520d3..c675efe9 100644 --- a/lib/properties/extractor.js +++ b/lib/properties/extractor.js @@ -14,6 +14,9 @@ function extract(token) { var splitAt = property.indexOf(':'); var name = property.substring(0, splitAt); + if (!name) + continue; + var nameRoot = findNameRoot(name); properties.push([ diff --git a/test/properties/extractor-test.js b/test/properties/extractor-test.js index 953c2430..781a39a9 100644 --- a/test/properties/extractor-test.js +++ b/test/properties/extractor-test.js @@ -15,6 +15,12 @@ vows.describe(extractor) assert.deepEqual(tokens, []); } }, + 'no valid properties': { + 'topic': extractor(buildToken('a{:red}')), + 'has no properties': function (tokens) { + assert.deepEqual(tokens, []); + } + }, 'one property': { 'topic': extractor(buildToken('a{color:red}')), 'has no properties': function (tokens) {