From f78d2fbd786978fb8680deffd48f7d47c2e8a82f Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Fri, 27 Feb 2015 19:48:27 +0000 Subject: [PATCH] Fixes #469 - extracting from broken property. That should never happen but skip such properties if ever encountered. --- History.md | 1 + lib/properties/extractor.js | 3 +++ test/properties/extractor-test.js | 6 ++++++ 3 files changed, 10 insertions(+) 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) { -- 2.34.1