Fixes #469 - extracting from broken property.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Fri, 27 Feb 2015 19:48:27 +0000 (19:48 +0000)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Fri, 27 Feb 2015 19:49:31 +0000 (19:49 +0000)
That should never happen but skip such properties if ever encountered.

History.md
lib/properties/extractor.js
test/properties/extractor-test.js

index 4c5ba7e..493da1f 100644 (file)
@@ -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.
 
index 418520d..c675efe 100644 (file)
@@ -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([
index 953c243..781a39a 100644 (file)
@@ -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) {