diff --git a/lib/mixins/element-mixin.html b/lib/mixins/element-mixin.html index 2fed46d2b8..3f0483888f 100644 --- a/lib/mixins/element-mixin.html +++ b/lib/mixins/element-mixin.html @@ -21,8 +21,6 @@ (function() { 'use strict'; - const ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/; - /** * Element class mixin that provides the core API for Polymer's meta-programming * features including template stamping, data-binding, attribute deserialization, @@ -635,11 +633,6 @@ * @return {string} Rewritten URL relative to base */ resolveUrl(url, base) { - // Preserve backward compatibility with `this.resolveUrl('/foo')` resolving - // against the main document per #2448 - if (url && ABS_URL.test(url)) { - return url; - } if (!base && this.importPath) { base = Polymer.ResolveUrl.resolveUrl(this.importPath); } diff --git a/lib/utils/resolve-url.html b/lib/utils/resolve-url.html index 612847b1ce..357ef6a322 100644 --- a/lib/utils/resolve-url.html +++ b/lib/utils/resolve-url.html @@ -15,6 +15,7 @@ 'use strict'; let CSS_URL_RX = /(url\()([^)]*)(\))/g; + let ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/; let workingURL; let resolveDoc; /** @@ -26,6 +27,9 @@ * @return {string} resolved URL */ function resolveUrl(url, baseURI) { + if (url && ABS_URL.test(url)) { + return url; + } // Lazy feature detection. if (workingURL === undefined) { workingURL = false; diff --git a/test/unit/resolveurl.html b/test/unit/resolveurl.html index ccf16ea873..8b08f692d3 100644 --- a/test/unit/resolveurl.html +++ b/test/unit/resolveurl.html @@ -157,12 +157,6 @@ assert.equal(actual, expected); }); }); - - suite('Polymer.ResolveUrl', function() { - test('appends absolute url to basePath', function() { - assert.equal(Polymer.ResolveUrl.resolveUrl('/foo', 'http://localhost'), 'http://localhost/foo'); - }); - });