Don't try to use variable values that do not exist on the browser. Fixes #190.

This commit is contained in:
Colin Snover
2012-01-10 16:12:08 +00:00
committed by Luke Page
parent e812e16656
commit 2c75e4f332

View File

@@ -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' && !/^(?:https?:\/\/|file:\/\/|data:|\/)/.test(val.value) && paths.length > 0) {
if (typeof window !== 'undefined' && val.value && !/^(?: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;