Adds small improvements to `reduceNonAdjacent` optimizer.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Sun, 22 Mar 2015 17:07:02 +0000 (17:07 +0000)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Mon, 23 Mar 2015 19:57:34 +0000 (19:57 +0000)
lib/selectors/optimizers/advanced.js

index ac8036e..98cb937 100644 (file)
@@ -97,10 +97,11 @@ AdvancedOptimizer.prototype.reduceNonAdjacent = function (tokens) {
     if (token[0] != 'selector')
       continue;
 
-    var isComplexAndNotSpecial = token[1].length > 1 && !this.isSpecial(stringifySelector(token[1]));
+    var selectorAsString = stringifySelector(token[1]);
+    var isComplexAndNotSpecial = token[1].length > 1 && !this.isSpecial(selectorAsString);
     var selectors = isComplexAndNotSpecial ?
-      [stringifySelector(token[1])].concat(token[1]) :
-      [stringifySelector(token[1])];
+      [selectorAsString].concat(token[1]) :
+      [selectorAsString];
 
     for (var j = 0, m = selectors.length; j < m; j++) {
       var selector = selectors[j];