10000 adjusted indent-whitespace to 4 spaces · rusongyu/less.js@081c26d · GitHub
[go: up one dir, main page]

Skip to content

Commit 081c26d

Browse files
committed
adjusted indent-whitespace to 4 spaces
1 parent 936ab7d commit 081c26d

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

lib/less/tree/media.js

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ tree.Media.prototype = {
1919
},
2020
eval: function (env) {
2121
if (!env.mediaBlocks) {
22-
env.mediaBlocks = [];
23-
env.mediaPath = [];
22+
env.mediaBlocks = [];
23+
env.mediaPath = [];
2424
}
2525

2626
env.mediaBlocks.push(this);
@@ -34,78 +34,78 @@ tree.Media.prototype = {
3434
env.mediaPath.pop();
3535

3636
if (env.mediaPath.length === 0) {
37-
return this.evalTop(env);
37+
return this.evalTop(env);
3838
} else {
39-
return this.evalNested(env);
39+
return this.evalNested(env);
4040
}
4141
},
4242
variable: function (name) { return tree.Ruleset.prototype.variable.call(this.ruleset, name) },
4343
find: function () { return tree.Ruleset.prototype.find.apply(this.ruleset, arguments) },
4444
rulesets: function () { return tree.Ruleset.prototype.rulesets.apply(this.ruleset) },
4545

4646
evalTop: function (env) {
47-
var result = this;
48-
49-
// Render all dependent Media blocks.
50-
if (env.mediaBlocks.length > 1) {
51-
var el = new(tree.Element)('&', null, 0);
52-
var selectors = [new(tree.Selector)([el])];
53-
result = new(tree.Ruleset)(selectors, env.mediaBlocks);
54-
result.multiMedia = true;
55-
}
47+
var result = this;
48+
49+
// Render all dependent Media blocks.
50+
if (env.mediaBlocks.length > 1) {
51+
var el = new(tree.Element)('&', null, 0);
52+
var selectors = [new(tree.Selector)([el])];
53+
result = new(tree.Ruleset)(selectors, env.mediaBlocks);
54+
result.multiMedia = true;
55+
}
5656

57-
delete env.mediaBlocks;
58-
delete env.mediaPath;
57+
delete env.mediaBlocks;
58+
delete env.mediaPath;
5959

60-
return result;
60+
return result;
6161
},
6262
evalNested: function (env) {
63-
var i, value,
64-
path = env.mediaPath.concat([this]);
65-
66-
// Extract the media-query conditions separated with `,` (OR).
67-
for (i = 0; i < path.length; i++) {
68-
value = path[i].features instanceof tree.Value ?
69-
path[i].features.value : path[i].features;
70-
path[i] = Array.isArray(value) ? value : [value];
71-
}
72-
73-
// Trace all permutations to generate the resulting media-query.
74-
//
75-
// (a, b and c) with nested (d, e) ->
76-
// a and d
77-
// a and e
78-
// b and c and d
79-
// b and c and e
80-
this.features = new(tree.Value)(this.permute(path).map(function (path) {
81-
path = path.map(function (fragment) {
82-
return fragment.toCSS ? fragment : new(tree.Anonymous)(fragment);
83-
});
84-
85-
for(i = path.length - 1; i > 0; i--) {
86-
path.splice(i, 0, new(tree.Anonymous)("and"));
63+
var i, value,
64+
path = env.mediaPath.concat([this]);
65+
66+
// Extract the media-query conditions separated with `,` (OR).
67+
for (i = 0; i < path.length; i++) {
68+
value = path[i].features instanceof tree.Value ?
69+
path[i].features.value : path[i].features;
70+
path[i] = Array.isArray(value) ? value : [value];
8771
}
8872

89-
return new(tree.Expression)(path);
90-
}));
91-
92-
// Fake a tree-node that doesn't output anything.
93-
return new(tree.Ruleset)([], []);
73+
// Trace all permutations to generate the resulting media-query.
74+
//
75+
// (a, b and c) with nested (d, e) ->
76+
// a and d
77+
// a and e
78+
// b and c and d
79+
// b and c and e
80+
this.features = new(tree.Value)(this.permute(path).map(function (path) {
81+
path = path.map(function (fragment) {
82+
return fragment.toCSS ? fragment : new(tree.Anonymous)(fragment);
83+
});
84+
85+
for(i = path.length - 1; i > 0; i--) {
86+
path.splice(i, 0, new(tree.Anonymous)("and"));
87+
}
88+
89+
return new(tree.Expression)(path);
90+
}));
91+
92+
// Fake a tree-node that doesn't output anything.
93+
return new(tree.Ruleset)([], []);
9494
},
9595
permute: function (arr) {
9696
if (arr.length == 0) {
97-
return [];
97+
return [];
9898
} else if (arr.length == 1) {
99-
return arr[0];
99+
return arr[0];
100100
} else {
101-
var result = [];
102-
var rest = this.permute(arr.slice(1));
103-
for (var i = 0; i < rest.length; i++) {
104-
for (var j = 0; j < arr[0].length; j++) {
105-
result.push([arr[0][j]].concat(rest[i]));
101+
var result = [];
102+
var rest = this.permute(arr.slice(1));
103+
for (var i = 0; i < rest.length; i++) {
104+
for (var j = 0; j < arr[0].length; j++) {
105+
result.push([arr[0][j]].concat(rest[i]));
106+
}
106107
}
107-
}
108-
return result;
108+
return result;
109109
}
110110
}
111111
};

0 commit comments

Comments
 (0)
0