mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
tighten up two if statements to stop exception in browser mode. fixes #807
This commit is contained in:
@@ -639,7 +639,7 @@ less.Parser = function Parser(env) {
|
||||
|
||||
expect(')');
|
||||
|
||||
return new(tree.URL)((value.value || value.data || value instanceof tree.Variable)
|
||||
return new(tree.URL)((value.value != null || value.data || value instanceof tree.Variable)
|
||||
? value : new(tree.Anonymous)(value), imports.paths);
|
||||
},
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ tree.URL = function (val, paths) {
|
||||
this.attrs = val;
|
||||
} else {
|
||||
// Add the base path if the URL is relative and we are in the browser
|
||||
if (typeof window !== 'undefined' && val.value && !/^(?:https?:\/\/|file:\/\/|data:|\/)/.test(val.value) && paths.length > 0) {
|
||||
if (typeof window !== 'undefined' && typeof val.value === "string" && !/^(?:https?:\/\/|file:\/\/|data:|\/)/.test(val.value) && paths.length > 0) {
|
||||
val.value = paths[0] + (val.value.charAt(0) === '/' ? val.value.slice(1) : val.value);
|
||||
}
|
||||
this.value = val;
|
||||
|
||||
Reference in New Issue
Block a user