mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
cache variable lookup for a 20% speedup
This commit is contained in:
@@ -7,9 +7,12 @@ tree.Ruleset = function Ruleset(selectors, rules) {
|
||||
tree.Ruleset.prototype = {
|
||||
eval: function () { return this },
|
||||
variables: function () {
|
||||
return this.rules.filter(function (r) {
|
||||
if (r instanceof tree.Rule && r.variable === true) { return r }
|
||||
});
|
||||
if (this._variables) { return this._variables }
|
||||
else {
|
||||
return this._variables = this.rules.filter(function (r) {
|
||||
if (r instanceof tree.Rule && r.variable === true) { return r }
|
||||
});
|
||||
}
|
||||
},
|
||||
find: function (selector, self) {
|
||||
self = self || this;
|
||||
|
||||
Reference in New Issue
Block a user