mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
when evaluating a mixin, compile all matches, instead of just the first one
This commit is contained in:
@@ -10,9 +10,9 @@ tree.mixin.Call.prototype = {
|
||||
var mixin, rules = [];
|
||||
|
||||
for (var i = 0; i < env.frames.length; i++) {
|
||||
if (mixin = env.frames[i].find(this.selector)) {
|
||||
for (var r = 0; r < mixin.rules.length; r++) {
|
||||
rules.push(mixin.rules[r]);
|
||||
if ((mixins = env.frames[i].find(this.selector)).length > 0) {
|
||||
for (var m = 0; m < mixins.length; m++) {
|
||||
Array.prototype.push.apply(rules, mixins[m].rules);
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,15 @@ tree.Ruleset.prototype = {
|
||||
},
|
||||
mixable: function (fun) {
|
||||
return this.rules.filter(function (r) {
|
||||
if (r instanceof tree.mixin.Definition || r instanceof tree.Ruleset) { return r }
|
||||
if (r instanceof tree.mixin.Definition || r instanceof tree.Ruleset) {
|
||||
if (typeof(fun) === 'function') {
|
||||
return fun.call(this, r);
|
||||
} else { return r }
|
||||
}
|
||||
});
|
||||
},
|
||||
find: function (selector) {
|
||||
return this.mixable().find(function (rule) {
|
||||
return this.mixable(function (rule) {
|
||||
for (var j = 0; j < rule.selectors.length; j++) {
|
||||
if (selector.elements[0].value === rule.selectors[j].elements[0].value) {
|
||||
if (selector.elements.length > 1) {
|
||||
|
||||
Reference in New Issue
Block a user