Skip to content

Commit 127bc86

Browse files
authored
Revert "Move absolute url logic to element-mixin"
1 parent 62fd4c5 commit 127bc86

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

lib/mixins/element-mixin.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
(function() {
2222
'use strict';
2323

24-
const ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/;
25-
2624
/**
2725
* Element class mixin that provides the core API for Polymer's meta-programming
2826
* features including template stamping, data-binding, attribute deserialization,
@@ -635,11 +633,6 @@
635633
* @return {string} Rewritten URL relative to base
636634
*/
637635
resolveUrl(url, base) {
638-
// Preserve backward compatibility with `this.resolveUrl('/foo')` resolving
639-
// against the main document per #2448
640-
if (url && ABS_URL.test(url)) {
641-
return url;
642-
}
643636
if (!base && this.importPath) {
644637
base = Polymer.ResolveUrl.resolveUrl(this.importPath);
645638
}

lib/utils/resolve-url.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
'use strict';
1616

1717
let CSS_URL_RX = /(url\()([^)]*)(\))/g;
18+
let ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/;
1819
let workingURL;
1920
let resolveDoc;
2021
/**
@@ -26,6 +27,9 @@
2627
* @return {string} resolved URL
2728
*/
2829
function resolveUrl(url, baseURI) {
30+
if (url && ABS_URL.test(url)) {
31+
return url;
32+
}
2933
// Lazy feature detection.
3034
if (workingURL === undefined) {
3135
workingURL = false;

test/unit/resolveurl.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,6 @@
157157
assert.equal(actual, expected);
158158
});
159159
});
160-
161-
suite('Polymer.ResolveUrl', function() {
162-
test('appends absolute url to basePath', function() {
163-
assert.equal(Polymer.ResolveUrl.resolveUrl('/foo', 'http://localhost'), 'http://localhost/foo');
164-
});
165-
});
166160
</script>
167161
</body>
168162
</html>

0 commit comments

Comments
 (0)