Once applying the rootpath, null it so it will not be applied again

This commit is contained in:
Luke Page
2013-02-09 12:40:08 +00:00
parent 88f3f02213
commit 681725f0d2

View File

@@ -12,7 +12,7 @@ tree.URL.prototype = {
var val = this.value.eval(ctx), rootpath;
// Add the base path if the URL is relative
if (typeof val.value === "string" && !/^(?:[a-z-]+:|\/)/.test(val.value)) {
if (this.rootpath && typeof val.value === "string" && !/^(?:[a-z-]+:|\/)/.test(val.value)) {
rootpath = this.rootpath;
if (!val.quote) {
rootpath = rootpath.replace(/[\(\)'"\s]/g, function(match) { return "\\"+match; });
@@ -20,7 +20,7 @@ tree.URL.prototype = {
val.value = rootpath + val.value;
}
return new(tree.URL)(val, this.rootpath);
return new(tree.URL)(val, null);
}
};