[Pkg-javascript-commits] [less.js] 35/285: move the visitors to return themselves instead of assuming where they live
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:23:35 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag v2.0.0
in repository less.js.
commit e5b0fb6967c16b47f72cd820928619ad543da238
Author: Luke Page <luke.a.page at gmail.com>
Date: Sun Mar 2 10:19:05 2014 +0000
move the visitors to return themselves instead of assuming where they live
---
lib/less/browser.js | 2 +-
lib/less/colors.js | 151 ----------------------
lib/less/data/colors.js | 149 +++++++++++++++++++++
lib/less/{environments => environment}/api.js | 0
lib/less/{environments => environment}/browser.js | 0
lib/less/{environments => environment}/node.js | 0
lib/less/extend-visitor.js | 11 +-
lib/less/import-visitor.js | 6 +-
lib/less/index.js | 2 +-
lib/less/join-selector-visitor.js | 11 +-
lib/less/non-node-index.js | 19 +--
lib/less/parser.js | 2 +-
lib/less/source-map-output.js | 13 +-
lib/less/to-css-visitor.js | 6 +-
lib/less/tree.js | 2 +-
lib/less/tree/color.js | 6 +-
lib/less/visitor.js | 6 +-
17 files changed, 196 insertions(+), 190 deletions(-)
diff --git a/lib/less/browser.js b/lib/less/browser.js
index 6ba6fa7..a335f19 100644
--- a/lib/less/browser.js
+++ b/lib/less/browser.js
@@ -21,7 +21,7 @@ function log(str, level) {
var isFileProtocol = /^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);
-less.environment = require("./environments/browser.js")(less, isFileProtocol, log, logLevel);
+less.environment = require("./environment/browser.js")(less, isFileProtocol, log, logLevel);
window.less = less;
less.env = options.env || (location.hostname == '127.0.0.1' ||
diff --git a/lib/less/colors.js b/lib/less/colors.js
deleted file mode 100644
index dd213f2..0000000
--- a/lib/less/colors.js
+++ /dev/null
@@ -1,151 +0,0 @@
-module.exports = function (tree) {
- tree.colors = {
- 'aliceblue':'#f0f8ff',
- 'antiquewhite':'#faebd7',
- 'aqua':'#00ffff',
- 'aquamarine':'#7fffd4',
- 'azure':'#f0ffff',
- 'beige':'#f5f5dc',
- 'bisque':'#ffe4c4',
- 'black':'#000000',
- 'blanchedalmond':'#ffebcd',
- 'blue':'#0000ff',
- 'blueviolet':'#8a2be2',
- 'brown':'#a52a2a',
- 'burlywood':'#deb887',
- 'cadetblue':'#5f9ea0',
- 'chartreuse':'#7fff00',
- 'chocolate':'#d2691e',
- 'coral':'#ff7f50',
- 'cornflowerblue':'#6495ed',
- 'cornsilk':'#fff8dc',
- 'crimson':'#dc143c',
- 'cyan':'#00ffff',
- 'darkblue':'#00008b',
- 'darkcyan':'#008b8b',
- 'darkgoldenrod':'#b8860b',
- 'darkgray':'#a9a9a9',
- 'darkgrey':'#a9a9a9',
- 'darkgreen':'#006400',
- 'darkkhaki':'#bdb76b',
- 'darkmagenta':'#8b008b',
- 'darkolivegreen':'#556b2f',
- 'darkorange':'#ff8c00',
- 'darkorchid':'#9932cc',
- 'darkred':'#8b0000',
- 'darksalmon':'#e9967a',
- 'darkseagreen':'#8fbc8f',
- 'darkslateblue':'#483d8b',
- 'darkslategray':'#2f4f4f',
- 'darkslategrey':'#2f4f4f',
- 'darkturquoise':'#00ced1',
- 'darkviolet':'#9400d3',
- 'deeppink':'#ff1493',
- 'deepskyblue':'#00bfff',
- 'dimgray':'#696969',
- 'dimgrey':'#696969',
- 'dodgerblue':'#1e90ff',
- 'firebrick':'#b22222',
- 'floralwhite':'#fffaf0',
- 'forestgreen':'#228b22',
- 'fuchsia':'#ff00ff',
- 'gainsboro':'#dcdcdc',
- 'ghostwhite':'#f8f8ff',
- 'gold':'#ffd700',
- 'goldenrod':'#daa520',
- 'gray':'#808080',
- 'grey':'#808080',
- 'green':'#008000',
- 'greenyellow':'#adff2f',
- 'honeydew':'#f0fff0',
- 'hotpink':'#ff69b4',
- 'indianred':'#cd5c5c',
- 'indigo':'#4b0082',
- 'ivory':'#fffff0',
- 'khaki':'#f0e68c',
- 'lavender':'#e6e6fa',
- 'lavenderblush':'#fff0f5',
- 'lawngreen':'#7cfc00',
- 'lemonchiffon':'#fffacd',
- 'lightblue':'#add8e6',
- 'lightcoral':'#f08080',
- 'lightcyan':'#e0ffff',
- 'lightgoldenrodyellow':'#fafad2',
- 'lightgray':'#d3d3d3',
- 'lightgrey':'#d3d3d3',
- 'lightgreen':'#90ee90',
- 'lightpink':'#ffb6c1',
- 'lightsalmon':'#ffa07a',
- 'lightseagreen':'#20b2aa',
- 'lightskyblue':'#87cefa',
- 'lightslategray':'#778899',
- 'lightslategrey':'#778899',
- 'lightsteelblue':'#b0c4de',
- 'lightyellow':'#ffffe0',
- 'lime':'#00ff00',
- 'limegreen':'#32cd32',
- 'linen':'#faf0e6',
- 'magenta':'#ff00ff',
- 'maroon':'#800000',
- 'mediumaquamarine':'#66cdaa',
- 'mediumblue':'#0000cd',
- 'mediumorchid':'#ba55d3',
- 'mediumpurple':'#9370d8',
- 'mediumseagreen':'#3cb371',
- 'mediumslateblue':'#7b68ee',
- 'mediumspringgreen':'#00fa9a',
- 'mediumturquoise':'#48d1cc',
- 'mediumvioletred':'#c71585',
- 'midnightblue':'#191970',
- 'mintcream':'#f5fffa',
- 'mistyrose':'#ffe4e1',
- 'moccasin':'#ffe4b5',
- 'navajowhite':'#ffdead',
- 'navy':'#000080',
- 'oldlace':'#fdf5e6',
- 'olive':'#808000',
- 'olivedrab':'#6b8e23',
- 'orange':'#ffa500',
- 'orangered':'#ff4500',
- 'orchid':'#da70d6',
- 'palegoldenrod':'#eee8aa',
- 'palegreen':'#98fb98',
- 'paleturquoise':'#afeeee',
- 'palevioletred':'#d87093',
- 'papayawhip':'#ffefd5',
- 'peachpuff':'#ffdab9',
- 'peru':'#cd853f',
- 'pink':'#ffc0cb',
- 'plum':'#dda0dd',
- 'powderblue':'#b0e0e6',
- 'purple':'#800080',
- 'red':'#ff0000',
- 'rosybrown':'#bc8f8f',
- 'royalblue':'#4169e1',
- 'saddlebrown':'#8b4513',
- 'salmon':'#fa8072',
- 'sandybrown':'#f4a460',
- 'seagreen':'#2e8b57',
- 'seashell':'#fff5ee',
- 'sienna':'#a0522d',
- 'silver':'#c0c0c0',
- 'skyblue':'#87ceeb',
- 'slateblue':'#6a5acd',
- 'slategray':'#708090',
- 'slategrey':'#708090',
- 'snow':'#fffafa',
- 'springgreen':'#00ff7f',
- 'steelblue':'#4682b4',
- 'tan':'#d2b48c',
- 'teal':'#008080',
- 'thistle':'#d8bfd8',
- 'tomato':'#ff6347',
- 'turquoise':'#40e0d0',
- 'violet':'#ee82ee',
- 'wheat':'#f5deb3',
- 'white':'#ffffff',
- 'whitesmoke':'#f5f5f5',
- 'yellow':'#ffff00',
- 'yellowgreen':'#9acd32'
- };
-};
diff --git a/lib/less/data/colors.js b/lib/less/data/colors.js
new file mode 100644
index 0000000..30476a9
--- /dev/null
+++ b/lib/less/data/colors.js
@@ -0,0 +1,149 @@
+module.exports = {
+ 'aliceblue':'#f0f8ff',
+ 'antiquewhite':'#faebd7',
+ 'aqua':'#00ffff',
+ 'aquamarine':'#7fffd4',
+ 'azure':'#f0ffff',
+ 'beige':'#f5f5dc',
+ 'bisque':'#ffe4c4',
+ 'black':'#000000',
+ 'blanchedalmond':'#ffebcd',
+ 'blue':'#0000ff',
+ 'blueviolet':'#8a2be2',
+ 'brown':'#a52a2a',
+ 'burlywood':'#deb887',
+ 'cadetblue':'#5f9ea0',
+ 'chartreuse':'#7fff00',
+ 'chocolate':'#d2691e',
+ 'coral':'#ff7f50',
+ 'cornflowerblue':'#6495ed',
+ 'cornsilk':'#fff8dc',
+ 'crimson':'#dc143c',
+ 'cyan':'#00ffff',
+ 'darkblue':'#00008b',
+ 'darkcyan':'#008b8b',
+ 'darkgoldenrod':'#b8860b',
+ 'darkgray':'#a9a9a9',
+ 'darkgrey':'#a9a9a9',
+ 'darkgreen':'#006400',
+ 'darkkhaki':'#bdb76b',
+ 'darkmagenta':'#8b008b',
+ 'darkolivegreen':'#556b2f',
+ 'darkorange':'#ff8c00',
+ 'darkorchid':'#9932cc',
+ 'darkred':'#8b0000',
+ 'darksalmon':'#e9967a',
+ 'darkseagreen':'#8fbc8f',
+ 'darkslateblue':'#483d8b',
+ 'darkslategray':'#2f4f4f',
+ 'darkslategrey':'#2f4f4f',
+ 'darkturquoise':'#00ced1',
+ 'darkviolet':'#9400d3',
+ 'deeppink':'#ff1493',
+ 'deepskyblue':'#00bfff',
+ 'dimgray':'#696969',
+ 'dimgrey':'#696969',
+ 'dodgerblue':'#1e90ff',
+ 'firebrick':'#b22222',
+ 'floralwhite':'#fffaf0',
+ 'forestgreen':'#228b22',
+ 'fuchsia':'#ff00ff',
+ 'gainsboro':'#dcdcdc',
+ 'ghostwhite':'#f8f8ff',
+ 'gold':'#ffd700',
+ 'goldenrod':'#daa520',
+ 'gray':'#808080',
+ 'grey':'#808080',
+ 'green':'#008000',
+ 'greenyellow':'#adff2f',
+ 'honeydew':'#f0fff0',
+ 'hotpink':'#ff69b4',
+ 'indianred':'#cd5c5c',
+ 'indigo':'#4b0082',
+ 'ivory':'#fffff0',
+ 'khaki':'#f0e68c',
+ 'lavender':'#e6e6fa',
+ 'lavenderblush':'#fff0f5',
+ 'lawngreen':'#7cfc00',
+ 'lemonchiffon':'#fffacd',
+ 'lightblue':'#add8e6',
+ 'lightcoral':'#f08080',
+ 'lightcyan':'#e0ffff',
+ 'lightgoldenrodyellow':'#fafad2',
+ 'lightgray':'#d3d3d3',
+ 'lightgrey':'#d3d3d3',
+ 'lightgreen':'#90ee90',
+ 'lightpink':'#ffb6c1',
+ 'lightsalmon':'#ffa07a',
+ 'lightseagreen':'#20b2aa',
+ 'lightskyblue':'#87cefa',
+ 'lightslategray':'#778899',
+ 'lightslategrey':'#778899',
+ 'lightsteelblue':'#b0c4de',
+ 'lightyellow':'#ffffe0',
+ 'lime':'#00ff00',
+ 'limegreen':'#32cd32',
+ 'linen':'#faf0e6',
+ 'magenta':'#ff00ff',
+ 'maroon':'#800000',
+ 'mediumaquamarine':'#66cdaa',
+ 'mediumblue':'#0000cd',
+ 'mediumorchid':'#ba55d3',
+ 'mediumpurple':'#9370d8',
+ 'mediumseagreen':'#3cb371',
+ 'mediumslateblue':'#7b68ee',
+ 'mediumspringgreen':'#00fa9a',
+ 'mediumturquoise':'#48d1cc',
+ 'mediumvioletred':'#c71585',
+ 'midnightblue':'#191970',
+ 'mintcream':'#f5fffa',
+ 'mistyrose':'#ffe4e1',
+ 'moccasin':'#ffe4b5',
+ 'navajowhite':'#ffdead',
+ 'navy':'#000080',
+ 'oldlace':'#fdf5e6',
+ 'olive':'#808000',
+ 'olivedrab':'#6b8e23',
+ 'orange':'#ffa500',
+ 'orangered':'#ff4500',
+ 'orchid':'#da70d6',
+ 'palegoldenrod':'#eee8aa',
+ 'palegreen':'#98fb98',
+ 'paleturquoise':'#afeeee',
+ 'palevioletred':'#d87093',
+ 'papayawhip':'#ffefd5',
+ 'peachpuff':'#ffdab9',
+ 'peru':'#cd853f',
+ 'pink':'#ffc0cb',
+ 'plum':'#dda0dd',
+ 'powderblue':'#b0e0e6',
+ 'purple':'#800080',
+ 'red':'#ff0000',
+ 'rosybrown':'#bc8f8f',
+ 'royalblue':'#4169e1',
+ 'saddlebrown':'#8b4513',
+ 'salmon':'#fa8072',
+ 'sandybrown':'#f4a460',
+ 'seagreen':'#2e8b57',
+ 'seashell':'#fff5ee',
+ 'sienna':'#a0522d',
+ 'silver':'#c0c0c0',
+ 'skyblue':'#87ceeb',
+ 'slateblue':'#6a5acd',
+ 'slategray':'#708090',
+ 'slategrey':'#708090',
+ 'snow':'#fffafa',
+ 'springgreen':'#00ff7f',
+ 'steelblue':'#4682b4',
+ 'tan':'#d2b48c',
+ 'teal':'#008080',
+ 'thistle':'#d8bfd8',
+ 'tomato':'#ff6347',
+ 'turquoise':'#40e0d0',
+ 'violet':'#ee82ee',
+ 'wheat':'#f5deb3',
+ 'white':'#ffffff',
+ 'whitesmoke':'#f5f5f5',
+ 'yellow':'#ffff00',
+ 'yellowgreen':'#9acd32'
+};
\ No newline at end of file
diff --git a/lib/less/environments/api.js b/lib/less/environment/api.js
similarity index 100%
rename from lib/less/environments/api.js
rename to lib/less/environment/api.js
diff --git a/lib/less/environments/browser.js b/lib/less/environment/browser.js
similarity index 100%
rename from lib/less/environments/browser.js
rename to lib/less/environment/browser.js
diff --git a/lib/less/environments/node.js b/lib/less/environment/node.js
similarity index 100%
rename from lib/less/environments/node.js
rename to lib/less/environment/node.js
diff --git a/lib/less/extend-visitor.js b/lib/less/extend-visitor.js
index 211e6ad..0fd22a4 100644
--- a/lib/less/extend-visitor.js
+++ b/lib/less/extend-visitor.js
@@ -1,13 +1,13 @@
module.exports = function (tree) {
/*jshint loopfunc:true */
- tree.extendFinderVisitor = function() {
+ var extendFinderVisitor = function() {
this._visitor = new tree.visitor(this);
this.contexts = [];
this.allExtendsStack = [[]];
};
- tree.extendFinderVisitor.prototype = {
+ extendFinderVisitor.prototype = {
run: function (root) {
root = this._visitor.visit(root);
root.allExtends = this.allExtendsStack[0];
@@ -85,13 +85,13 @@ module.exports = function (tree) {
}
};
- tree.processExtendsVisitor = function() {
+ var processExtendsVisitor = function() {
this._visitor = new tree.visitor(this);
};
- tree.processExtendsVisitor.prototype = {
+ processExtendsVisitor.prototype = {
run: function(root) {
- var extendFinder = new tree.extendFinderVisitor();
+ var extendFinder = new extendFinderVisitor();
extendFinder.run(root);
if (!extendFinder.foundExtends) { return root; }
root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends));
@@ -413,4 +413,5 @@ module.exports = function (tree) {
}
};
+ return processExtendsVisitor;
};
diff --git a/lib/less/import-visitor.js b/lib/less/import-visitor.js
index b94f58d..3da88b5 100644
--- a/lib/less/import-visitor.js
+++ b/lib/less/import-visitor.js
@@ -1,5 +1,5 @@
module.exports = function (tree) {
- tree.importVisitor = function(importer, finish, evalEnv, onceFileDetectionMap, recursionDetector) {
+ var importVisitor = function(importer, finish, evalEnv, onceFileDetectionMap, recursionDetector) {
this._visitor = new tree.visitor(this);
this._importer = importer;
this._finish = finish;
@@ -16,7 +16,7 @@ module.exports = function (tree) {
}
};
- tree.importVisitor.prototype = {
+ importVisitor.prototype = {
isReplacing: true,
run: function (root) {
var error;
@@ -138,5 +138,5 @@ module.exports = function (tree) {
this.env.frames.shift();
}
};
-
+ return importVisitor;
};
diff --git a/lib/less/index.js b/lib/less/index.js
index ea47acb..f4730de 100644
--- a/lib/less/index.js
+++ b/lib/less/index.js
@@ -90,6 +90,6 @@ less.writeError = function (ctx, options) {
console.error(less.formatError(ctx, options));
};
-less.environment = require("./environments/node");
+less.environment = require("./environment/node");
module.exports = less;
diff --git a/lib/less/join-selector-visitor.js b/lib/less/join-selector-visitor.js
index 13b3a59..bc511d9 100644
--- a/lib/less/join-selector-visitor.js
+++ b/lib/less/join-selector-visitor.js
@@ -1,10 +1,10 @@
-module.exports = function (tree) {
- tree.joinSelectorVisitor = function() {
+module.exports = function (visitor) {
+ var joinSelectorVisitor = function() {
this.contexts = [[]];
- this._visitor = new tree.visitor(this);
+ this._visitor = new visitor(this);
};
- tree.joinSelectorVisitor.prototype = {
+ joinSelectorVisitor.prototype = {
run: function (root) {
return this._visitor.visit(root);
},
@@ -40,5 +40,6 @@ module.exports = function (tree) {
mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia);
}
};
-
+
+ return joinSelectorVisitor;
};
\ No newline at end of file
diff --git a/lib/less/non-node-index.js b/lib/less/non-node-index.js
index 5cd0ad1..e3426a7 100644
--- a/lib/less/non-node-index.js
+++ b/lib/less/non-node-index.js
@@ -1,5 +1,8 @@
var less = {
- version: [1, 6, 3]
+ version: [1, 6, 3],
+ data: {
+ colors: require('./data/colors')
+ }
};
less.tree = (require('./tree'))(less);
@@ -7,12 +10,12 @@ less.Parser = (require('./parser'))(less, less.tree);
less.tree.functions = (require('./functions'))(less, less.tree);
require('./env')(less.tree);
-require('./colors')(less.tree);
-require('./visitor.js')(less.tree);
-require('./import-visitor.js')(less.tree);
-require('./extend-visitor.js')(less.tree);
-require('./join-selector-visitor.js')(less.tree);
-require('./to-css-visitor.js')(less.tree);
-require('./source-map-output.js')(less, less.tree);
+less.tree.visitor = require('./visitor.js')(less.tree);
+less.tree.importVisitor = require('./import-visitor.js')(less.tree);
+less.tree.extendVisitor = require('./extend-visitor.js')(less.tree);
+less.tree.joinSelectorVisitor = require('./join-selector-visitor.js')(less.tree.visitor);
+less.tree.toCSSVisitor = require('./to-css-visitor.js')(less.tree);
+
+less.tree.sourceMapOutput = require('./source-map-output.js')(less);
module.exports = less;
diff --git a/lib/less/parser.js b/lib/less/parser.js
index 2afa3f4..b2ae224 100644
--- a/lib/less/parser.js
+++ b/lib/less/parser.js
@@ -558,7 +558,7 @@ var Parser = function Parser(env) {
var preEvalVisitors = [],
visitors = [
new(tree.joinSelectorVisitor)(),
- new(tree.processExtendsVisitor)(),
+ new(tree.extendVisitor)(),
new(tree.toCSSVisitor)({compress: Boolean(options.compress)})
], i, root = this;
diff --git a/lib/less/source-map-output.js b/lib/less/source-map-output.js
index 9cdc818..b32bda2 100644
--- a/lib/less/source-map-output.js
+++ b/lib/less/source-map-output.js
@@ -1,6 +1,6 @@
-module.exports = function (less, tree) {
+module.exports = function (less) {
- tree.sourceMapOutput = function (options) {
+ var sourceMapOutput = function (options) {
this._css = [];
this._rootNode = options.rootNode;
this._writeSourceMap = options.writeSourceMap;
@@ -24,7 +24,7 @@ module.exports = function (less, tree) {
this._column = 0;
};
- tree.sourceMapOutput.prototype.normalizeFilename = function(filename) {
+ sourceMapOutput.prototype.normalizeFilename = function(filename) {
filename = filename.replace(/\\/g, '/');
if (this._sourceMapBasepath && filename.indexOf(this._sourceMapBasepath) === 0) {
@@ -36,7 +36,7 @@ module.exports = function (less, tree) {
return (this._sourceMapRootpath || "") + filename;
};
- tree.sourceMapOutput.prototype.add = function(chunk, fileInfo, index, mapLines) {
+ sourceMapOutput.prototype.add = function(chunk, fileInfo, index, mapLines) {
//ignore adding empty strings
if (!chunk) {
@@ -92,11 +92,11 @@ module.exports = function (less, tree) {
this._css.push(chunk);
};
- tree.sourceMapOutput.prototype.isEmpty = function() {
+ sourceMapOutput.prototype.isEmpty = function() {
return this._css.length === 0;
};
- tree.sourceMapOutput.prototype.toCSS = function(env) {
+ sourceMapOutput.prototype.toCSS = function(env) {
this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null });
if (this._outputSourceFiles) {
@@ -138,4 +138,5 @@ module.exports = function (less, tree) {
return this._css.join('');
};
+ return sourceMapOutput;
};
diff --git a/lib/less/to-css-visitor.js b/lib/less/to-css-visitor.js
index c58f11a..ad689e4 100644
--- a/lib/less/to-css-visitor.js
+++ b/lib/less/to-css-visitor.js
@@ -1,10 +1,10 @@
module.exports = function (tree) {
- tree.toCSSVisitor = function(env) {
+ var toCSSVisitor = function(env) {
this._visitor = new tree.visitor(this);
this._env = env;
};
- tree.toCSSVisitor.prototype = {
+ toCSSVisitor.prototype = {
isReplacing: true,
run: function (root) {
return this._visitor.visit(root);
@@ -236,4 +236,6 @@ module.exports = function (tree) {
});
}
};
+
+ return toCSSVisitor;
};
diff --git a/lib/less/tree.js b/lib/less/tree.js
index fac177b..393f71b 100644
--- a/lib/less/tree.js
+++ b/lib/less/tree.js
@@ -97,7 +97,7 @@ tree.outputRuleset = function (env, output, rules) {
};
tree.Alpha = require('./tree/alpha')(tree);
-tree.Color = require('./tree/color')(tree);
+tree.Color = require('./tree/color')(less.data, tree);
tree.Directive = require('./tree/directive')(tree);
tree.DetachedRuleset = require('./tree/detached-ruleset')(tree);
tree.Operation = require('./tree/operation')(tree);
diff --git a/lib/less/tree/color.js b/lib/less/tree/color.js
index 0cf128b..ffe9dfb 100644
--- a/lib/less/tree/color.js
+++ b/lib/less/tree/color.js
@@ -1,4 +1,4 @@
-module.exports = function (tree) {
+module.exports = function (data, tree) {
//
// RGB Colors - #ff0014, #eee
//
@@ -165,8 +165,8 @@ Color.prototype = {
Color.fromKeyword = function(keyword) {
var c, key = keyword.toLowerCase();
- if (tree.colors.hasOwnProperty(key)) {
- c = new(Color)(tree.colors[key].slice(1));
+ if (data.colors.hasOwnProperty(key)) {
+ c = new(Color)(data.colors[key].slice(1));
}
else if (key === "transparent") {
c = new(Color)([0, 0, 0], 0);
diff --git a/lib/less/visitor.js b/lib/less/visitor.js
index d4696e7..d6cade4 100644
--- a/lib/less/visitor.js
+++ b/lib/less/visitor.js
@@ -30,7 +30,7 @@ module.exports = function (tree) {
return ticker;
}
- tree.visitor = function(implementation) {
+ var visitor = function(implementation) {
this._implementation = implementation;
this._visitFnCache = [];
@@ -40,7 +40,7 @@ module.exports = function (tree) {
}
};
- tree.visitor.prototype = {
+ visitor.prototype = {
visit: function(node) {
if (!node) {
return node;
@@ -142,5 +142,5 @@ module.exports = function (tree) {
return out;
}
};
-
+ return visitor;
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git
More information about the Pkg-javascript-commits
mailing list