whatwg-url 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/URL-impl.js +6 -2
- package/lib/url-state-machine.js +8 -2
- package/package.json +1 -1
- package/coverage/coverage.json +0 -1
- package/coverage/lcov-report/base.css +0 -212
- package/coverage/lcov-report/index.html +0 -93
- package/coverage/lcov-report/lib/URL-impl.js.html +0 -701
- package/coverage/lcov-report/lib/URL.js.html +0 -692
- package/coverage/lcov-report/lib/index.html +0 -145
- package/coverage/lcov-report/lib/public-api.js.html +0 -98
- package/coverage/lcov-report/lib/url-state-machine.js.html +0 -3566
- package/coverage/lcov-report/lib/utils.js.html +0 -125
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -1
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -158
- package/coverage/lcov.info +0 -1789
package/lib/URL-impl.js
CHANGED
|
@@ -143,8 +143,12 @@ exports.implementation = class URLImpl {
|
|
|
143
143
|
if (this._url.host === null || this._url.cannotBeABaseURL || this._url.scheme === "file") {
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
|
|
147
|
+
if (v === "") {
|
|
148
|
+
this._url.port = null;
|
|
149
|
+
} else {
|
|
150
|
+
usm.basicURLParse(v, { url: this._url, stateOverride: "port" });
|
|
151
|
+
}
|
|
148
152
|
}
|
|
149
153
|
|
|
150
154
|
get pathname() {
|
package/lib/url-state-machine.js
CHANGED
|
@@ -424,6 +424,12 @@ function trimTabAndNewline(url) {
|
|
|
424
424
|
return url.replace(/\u0009|\u000A|\u000D/g, "");
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
+
function popPath(url) {
|
|
428
|
+
if (url.scheme !== "file" || !url.path.filter((seg) => /^[A-Za-z](|:)$/.test(seg)).length) {
|
|
429
|
+
url.path.pop();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
427
433
|
function URLStateMachine(input, base, encodingOverride, url, stateOverride) {
|
|
428
434
|
this.pointer = 0;
|
|
429
435
|
this.input = input;
|
|
@@ -828,7 +834,7 @@ URLStateMachine.prototype["parse file"] = function parseFile(c) {
|
|
|
828
834
|
[47, 92, 63, 35].indexOf(this.input[this.pointer + 2]) === -1) {
|
|
829
835
|
this.url.host = this.base.host;
|
|
830
836
|
this.url.path = this.base.path.slice();
|
|
831
|
-
this.url
|
|
837
|
+
popPath(this.url);
|
|
832
838
|
} else {
|
|
833
839
|
this.parseError = true;
|
|
834
840
|
}
|
|
@@ -907,7 +913,7 @@ URLStateMachine.prototype["parse path"] = function parsePath(c) {
|
|
|
907
913
|
}
|
|
908
914
|
|
|
909
915
|
if (isDoubleDot(this.buffer)) {
|
|
910
|
-
this.url
|
|
916
|
+
popPath(this.url);
|
|
911
917
|
if (c !== 47 && !(specialSchemas[this.url.scheme] !== undefined && c === 92)) {
|
|
912
918
|
this.url.path.push("");
|
|
913
919
|
}
|
package/package.json
CHANGED