Skip to content

Commit 4cc9b83

Browse files
committed
Merge branch 'master' of https://github.com/less/less.js
2 parents 9d9e650 + f727b26 commit 4cc9b83

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

packages/less/src/less-node/url-file-manager.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ UrlFileManager.prototype = Object.assign(new AbstractFileManager(), {
2727
const hackUrlStr = urlStr.indexOf('?') === -1 ? urlStr + '?' : urlStr
2828

2929
request.get(hackUrlStr, { follow_max: 5 }, (err, resp, body) => {
30-
if (err || resp.statusCode >= 400) {
31-
const message = resp.statusCode === 404
30+
if (err || resp && resp.statusCode >= 400) {
31+
const message = resp && resp.statusCode === 404
3232
? `resource '${urlStr}' was not found\n`
3333
: `resource '${urlStr}' gave this Error:\n ${err || resp.statusMessage || resp.statusCode}\n`;
3434
reject({ type: 'File', message });

packages/less/src/less/tree/dimension.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ Dimension.prototype = Object.assign(new Node(), {
6666
// so `1px + 2` will yield `3px`.
6767
operate(context, op, other) {
6868
/* jshint noempty:false */
69-
let value = this._operate(context, op, this.value, other.value), unit = this.unit.clone();
69+
let value = this._operate(context, op, this.value, other.value);
70+
let unit = this.unit.clone();
7071

7172
if (op === '+' || op === '-') {
7273
if (unit.numerator.length === 0 && unit.denominator.length === 0) {

packages/less/src/less/tree/operation.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ Operation.prototype = Object.assign(new Node(), {
2929
if (b instanceof Dimension && a instanceof Color) {
3030
b = b.toColor();
3131
}
32-
if (!a.operate) {
33-
if (a instanceof Operation && a.op === '/' && context.math === MATH.PARENS_DIVISION) {
32+
if (!a.operate || !b.operate) {
33+
if (
34+
(a instanceof Operation || b instanceof Operation)
35+
&& a.op === '/' && context.math === MATH.PARENS_DIVISION
36+
) {
3437
return new Operation(this.op, [a, b], this.isSpaced);
3538
}
3639
throw { type: 'Operation',

packages/test-data/less/math/parens-division/media-math.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@var: 16;
1+
@var: 10 + 6;
22

33
@media (min-width: @var + 1) {
44
.foo { bar: 1; }

0 commit comments

Comments
 (0)