diff --git a/lib/less/tree/selector.js b/lib/less/tree/selector.js index 331e18f86..89495a5ba 100644 --- a/lib/less/tree/selector.js +++ b/lib/less/tree/selector.js @@ -32,23 +32,23 @@ tree.Selector.prototype = { match: function (other) { var elements = this.elements, len = elements.length, - oelements, olen, max, i; + oelements, olen, i; oelements = other.elements.slice( (other.elements.length && other.elements[0].value === "&") ? 1 : 0); olen = oelements.length; - max = Math.min(len, olen); - + if (olen === 0 || len < olen) { return 0; - } else { - for (i = 0; i < max; i++) { - if (elements[i].value !== oelements[i].value) { - return 0; - } + } + + for (i = 0; i < olen; i++) { + if (elements[i].value !== oelements[i].value) { + return 0; } } - return max; // return number of matched selectors + + return olen; // return number of matched selectors }, eval: function (env) { var evaldCondition = this.condition && this.condition.eval(env),