Skip to content

Commit

Permalink
Revert "Move absolute url logic to element-mixin"
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf authored Jan 31, 2018
1 parent 62fd4c5 commit 127bc86
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
7 changes: 0 additions & 7 deletions lib/mixins/element-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/utils/resolve-url.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'use strict';

let CSS_URL_RX = /(url\()([^)]*)(\))/g;
let ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/;
let workingURL;
let resolveDoc;
/**
Expand All @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions test/unit/resolveurl.html
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
</script>
</body>
</html>

0 comments on commit 127bc86

Please sign in to comment.