Remove dead code around data URIs

This commit is contained in:
Tom MacWright 2012-06-19 15:36:50 -04:00
parent 17d569039b
commit c9129188c7
2 changed files with 5 additions and 15 deletions

View File

@ -496,7 +496,7 @@ carto.Parser = function Parser(env) {
if (! $(')')) {
return new tree.Invalid(value, memo, 'Missing closing ) in URL.');
} else {
return new tree.URL((value.value || value.data || value instanceof tree.Variable) ?
return new tree.URL((value.value || value instanceof tree.Variable) ?
value : new tree.Anonymous(value), imports.paths);
}
},

View File

@ -1,26 +1,16 @@
(function(tree) {
tree.URL = function URL(val, paths) {
if (val.data) {
this.attrs = val;
} else {
// Add the base path if the URL is relative and we are in the browser
if (!/^(?:https?:\/|file:\/)?\//.test(val.value) && paths.length > 0 && typeof(process) === 'undefined') {
val.value = paths[0] + (val.value.charAt(0) === '/' ? val.value.slice(1) : val.value);
}
this.value = val;
this.paths = paths;
this.is = 'uri';
}
this.value = val;
this.paths = paths;
this.is = 'uri';
};
tree.URL.prototype = {
toString: function() {
return this.value.toString();
},
eval: function(ctx) {
return this.attrs ? this : new tree.URL(this.value.eval(ctx), this.paths);
// URL case no longer supported.
// @TODO: throw an error?
return new tree.URL(this.value.eval(ctx), this.paths);
}
};