};
AdvancedOptimizer.prototype.mergeAdjacent = function (tokens) {
- var forRemoval = [];
var lastToken = [null, [], []];
var adjacentSpace = this.options.compatibility.selectors.adjacentSpace;
if (lastToken[0] == 'selector' && stringifySelector(token[1]) == stringifySelector(lastToken[1])) {
var joinAt = [lastToken[2].length];
lastToken[2] = this.propertyOptimizer.process(token[1], lastToken[2].concat(token[2]), joinAt, true);
- forRemoval.push(i);
+ token[2] = [];
} else if (lastToken[0] == 'selector' && stringifyBody(token[2]) == stringifyBody(lastToken[2]) &&
!this.isSpecial(stringifySelector(token[1])) && !this.isSpecial(stringifySelector(lastToken[1]))) {
lastToken[1] = CleanUp.selectors(lastToken[1].concat(token[1]), false, adjacentSpace);
- forRemoval.push(i);
+ token[2] = [];
} else {
lastToken = token;
}
}
-
- for (var j = 0, m = forRemoval.length; j < m; j++) {
- tokens.splice(forRemoval[j] - j, 1);
- }
};
AdvancedOptimizer.prototype.reduceNonAdjacent = function (tokens) {