Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit c4a5e24

Browse files
committed
URLUtils -> URL polyfill
1 parent 05e314b commit c4a5e24

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Gruntfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = function (grunt) {
2525
'src/wrapper-start.js',
2626
'src/loader.js',
2727
'src/dynamic-only.js',
28-
'src/url.js',
28+
'src/url-polyfill.js',
2929
'src/system.js',
3030
'src/wrapper-end.js'
3131
],
@@ -35,7 +35,7 @@ module.exports = function (grunt) {
3535
'src/loader.js',
3636
'src/declarative.js',
3737
'src/transpiler.js',
38-
'src/url.js',
38+
'src/url-polyfill.js',
3939
'src/system.js',
4040
'src/module-tag.js',
4141
'src/wrapper-end.js'

src/system.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
if (isBrowser)
190190
outPath = outPath.replace(/#/g, '%23');
191191

192-
return new URLUtils(outPath, baseURLCache[this.baseURL] = baseURLCache[this.baseURL] || new URLUtils(this.baseURL)).href;
192+
return new URL(outPath, baseURLCache[this.baseURL] = baseURLCache[this.baseURL] || new URL(this.baseURL)).href;
193193
};
194194

195195
SystemLoader.prototype.fetch = function(load) {

src/url.js renamed to src/url-polyfill.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// from https://gist.github.com/Yaffle/1088850
2-
function URLUtils(url, baseURL) {
2+
function URL(url, baseURL) {
33
if (typeof url != 'string')
44
throw new TypeError('URL must be a string');
55
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
@@ -16,7 +16,7 @@
1616
var search = m[8] || "";
1717
var hash = m[9] || "";
1818
if (baseURL !== undefined) {
19-
var base = baseURL instanceof URLUtils ? baseURL : new URLUtils(baseURL);
19+
var base = baseURL instanceof URL ? baseURL : new URL(baseURL);
2020
var flag = protocol === "" && host === "" && username === "";
2121
if (flag && pathname === "" && search === "") {
2222
search = base.search;

0 commit comments

Comments
 (0)