No shorthand compacting for less than 3 properties.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Sun, 12 Apr 2015 11:16:42 +0000 (12:16 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Sun, 12 Apr 2015 16:58:11 +0000 (17:58 +0100)
There is no shorthand for 2 properties so there is no way it may
shorten the content.

It speeds up processing by ~5%.

lib/properties/shorthand-compactor.js

index 2fbe09e..640db06 100644 (file)
@@ -76,6 +76,9 @@ function invalidateOrCompact(properties, position, candidates, validator) {
 function compactShortands(properties, compatibility, validator) {
   var candidates = {};
 
+  if (properties.length < 3)
+    return;
+
   for (var i = 0, l = properties.length; i < l; i++) {
     var property = properties[i];
     if (property.unused)