Skip to content

Commit 367b46a

Browse files
authoredFeb 10, 2018
Merge pull request #3161 from matthew-dean/3.x
Remove legacy upgrade
2 parents 2a4a63a + 4508495 commit 367b46a

File tree

10 files changed

+106
-184
lines changed

10 files changed

+106
-184
lines changed
 

‎dist/less.js

+71-136
Large diffs are not rendered by default.

‎dist/less.min.js

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/less/parser/parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ var Parser = function Parser(context, imports, fileInfo) {
374374
// black border-collapse
375375
//
376376
keyword: function () {
377-
var k = parserInput.$char("%") || parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]*/);
377+
var k = parserInput.$char("%") || parserInput.$re(/^\[?[_A-Za-z-][_A-Za-z0-9-]*\]?/);
378378
if (k) {
379379
return tree.Color.fromKeyword(k) || new(tree.Keyword)(k);
380380
}

‎lib/less/plugin-manager.js

-22
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
var utils = require('./utils');
21
/**
32
* Plugin Manager
43
*/
@@ -54,33 +53,12 @@ PluginManager.prototype.get = function(filename) {
5453
return this.pluginCache[filename];
5554
};
5655

57-
/**
58-
* Deprecate eventually
59-
*/
60-
function upgradeVisitors(visitor, oldType, newType) {
61-
62-
if (visitor['visit' + oldType] && !visitor['visit' + newType]) {
63-
visitor['visit' + newType] = visitor['visit' + oldType];
64-
}
65-
if (visitor['visit' + oldType + 'Out'] && !visitor['visit' + newType + 'Out']) {
66-
visitor['visit' + newType + 'Out'] = visitor['visit' + oldType + 'Out'];
67-
}
68-
}
6956
/**
7057
* Adds a visitor. The visitor object has options on itself to determine
7158
* when it should run.
7259
* @param visitor
7360
*/
7461
PluginManager.prototype.addVisitor = function(visitor) {
75-
var proto;
76-
// 2.x to 3.x visitor compatibility
77-
try {
78-
proto = utils.getPrototype(visitor);
79-
upgradeVisitors(proto, 'Directive', 'AtRule');
80-
upgradeVisitors(proto, 'Rule', 'Declaration');
81-
}
82-
catch (e) {}
83-
8462
this.visitors.push(visitor);
8563
};
8664
/**

‎lib/less/tree/index.js

-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ var tree = Object.create(null);
33
tree.Node = require('./node');
44
tree.Color = require('./color');
55
tree.AtRule = require('./atrule');
6-
// Backwards compatibility
7-
tree.Directive = require('./directive');
86
tree.DetachedRuleset = require('./detached-ruleset');
97
tree.Operation = require('./operation');
108
tree.Dimension = require('./dimension');
@@ -20,8 +18,6 @@ tree.Selector = require('./selector');
2018
tree.Quoted = require('./quoted');
2119
tree.Expression = require('./expression');
2220
tree.Declaration = require('./declaration');
23-
// Backwards compatibility
24-
tree.Rule = require('./rule');
2521
tree.Call = require('./call');
2622
tree.URL = require('./url');
2723
tree.Import = require('./import');

‎lib/less/utils.js

-13
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,5 @@ module.exports = {
6565
}
6666
}
6767
return obj1;
68-
},
69-
getPrototype: function(obj) {
70-
if (Object.getPrototypeOf) {
71-
return Object.getPrototypeOf(obj);
72-
}
73-
else {
74-
if ("".__proto__ === String.prototype) {
75-
return obj.__proto__;
76-
}
77-
else if (obj.constructor) {
78-
return obj.constructor.prototype;
79-
}
80-
}
8168
}
8269
};

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "less",
3-
"version": "3.0.0-RC.1",
3+
"version": "3.0.0-RC.2",
44
"description": "Leaner CSS",
55
"homepage": "http://lesscss.org",
66
"author": {

‎test/css/css-grid.css

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.wrapper {
2+
display: grid;
3+
grid-template-columns: [col1-start] 9fr [col1-end] 10px [col2-start] 3fr [col2-end];
4+
grid-template-rows: auto;
5+
}
6+
.wrapper {
7+
display: grid;
8+
grid-template-columns: 9fr 1.875em 3fr;
9+
grid-template-rows: auto;
10+
grid-template-areas: "header header header" "content . sidebar" "footer footer footer";
11+
}

‎test/less/css-grid.less

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.wrapper {
2+
display: grid;
3+
grid-template-columns: [col1-start] 9fr [col1-end] 10px [col2-start] 3fr [col2-end];
4+
grid-template-rows: auto;
5+
}
6+
7+
.wrapper {
8+
display: grid;
9+
grid-template-columns: 9fr 1.875em 3fr;
10+
grid-template-rows: auto;
11+
grid-template-areas:
12+
"header header header"
13+
"content . sidebar"
14+
"footer footer footer";
15+
}

‎test/plugins/visitor/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
run: function (root) {
99
return this._visitor.visit(root);
1010
},
11-
visitRule: function (ruleNode, visitArgs) {
11+
visitDeclaration: function (ruleNode, visitArgs) {
1212
if (ruleNode.name != '-some-aribitrary-property') {
1313
return ruleNode;
1414
} else {

0 commit comments

Comments
 (0)
Please sign in to comment.