whatwg-url
Advanced tools
Comparing version 11.0.0 to 12.0.0
@@ -174,2 +174,3 @@ "use strict"; | ||
this._query._list = []; | ||
this._potentiallyStripTrailingSpacesFromAnOpaquePath(); | ||
return; | ||
@@ -199,2 +200,3 @@ } | ||
this._url.fragment = null; | ||
this._potentiallyStripTrailingSpacesFromAnOpaquePath(); | ||
return; | ||
@@ -211,2 +213,18 @@ } | ||
} | ||
_potentiallyStripTrailingSpacesFromAnOpaquePath() { | ||
if (!usm.hasAnOpaquePath(this._url)) { | ||
return; | ||
} | ||
if (this._url.fragment !== null) { | ||
return; | ||
} | ||
if (this._url.query !== null) { | ||
return; | ||
} | ||
this._url.path = this._url.path.replace(/\u0020+$/u, ""); | ||
} | ||
}; |
@@ -56,7 +56,7 @@ "use strict"; | ||
function containsForbiddenHostCodePoint(string) { | ||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u) !== -1; | ||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u) !== -1; | ||
} | ||
function containsForbiddenHostCodePointExcludingPercent(string) { | ||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u) !== -1; | ||
function containsForbiddenDomainCodePoint(string) { | ||
return containsForbiddenHostCodePoint(string) || string.search(/[\u0000-\u001F]|%|\u007F/u) !== -1; | ||
} | ||
@@ -348,3 +348,3 @@ | ||
if (containsForbiddenHostCodePoint(asciiDomain)) { | ||
if (containsForbiddenDomainCodePoint(asciiDomain)) { | ||
return failure; | ||
@@ -382,3 +382,3 @@ } | ||
function parseOpaqueHost(input) { | ||
if (containsForbiddenHostCodePointExcludingPercent(input)) { | ||
if (containsForbiddenHostCodePoint(input)) { | ||
return failure; | ||
@@ -473,3 +473,3 @@ } | ||
function cannotHaveAUsernamePasswordPort(url) { | ||
return url.host === null || url.host === "" || hasAnOpaquePath(url) || url.scheme === "file"; | ||
return url.host === null || url.host === "" || url.scheme === "file"; | ||
} | ||
@@ -476,0 +476,0 @@ |
@@ -34,7 +34,12 @@ "use strict"; | ||
if (this._url !== null) { | ||
let query = urlencoded.serializeUrlencoded(this._list); | ||
if (query === "") { | ||
query = null; | ||
let serializedQuery = urlencoded.serializeUrlencoded(this._list); | ||
if (serializedQuery === "") { | ||
serializedQuery = null; | ||
} | ||
this._url._url.query = query; | ||
this._url._url.query = serializedQuery; | ||
if (serializedQuery === null) { | ||
this._url._potentiallyStripTrailingSpacesFromAnOpaquePath(); | ||
} | ||
} | ||
@@ -41,0 +46,0 @@ } |
{ | ||
"name": "whatwg-url", | ||
"version": "11.0.0", | ||
"version": "12.0.0", | ||
"description": "An implementation of the WHATWG URL Standard's URL API and parsing machinery", | ||
@@ -19,13 +19,13 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@domenic/eslint-config": "^1.4.0", | ||
"@domenic/eslint-config": "^3.0.0", | ||
"benchmark": "^2.1.4", | ||
"browserify": "^17.0.0", | ||
"domexception": "^4.0.0", | ||
"eslint": "^7.32.0", | ||
"got": "^11.8.2", | ||
"jest": "^27.2.4", | ||
"webidl2js": "^17.0.0" | ||
"esbuild": "^0.16.12", | ||
"eslint": "^8.30.0", | ||
"jest": "^29.3.1", | ||
"minipass-fetch": "^3.0.1", | ||
"webidl2js": "^17.1.0" | ||
}, | ||
"engines": { | ||
"node": ">=12" | ||
"node": ">=14" | ||
}, | ||
@@ -37,3 +37,3 @@ "scripts": { | ||
"pretest": "node scripts/get-latest-platform-tests.js && node scripts/transform.js", | ||
"build-live-viewer": "browserify index.js --standalone whatwgURL > live-viewer/whatwg-url.js", | ||
"build-live-viewer": "esbuild --bundle --format=esm --sourcemap --outfile=live-viewer/whatwg-url.mjs index.js", | ||
"test": "jest" | ||
@@ -40,0 +40,0 @@ }, |
@@ -7,3 +7,3 @@ # whatwg-url | ||
whatwg-url is currently up to date with the URL spec up to commit [43c2713](https://github.com/whatwg/url/commit/43c27137a0bc82c4b800fe74be893255fbeb35f4). | ||
whatwg-url is currently up to date with the URL spec up to commit [fdaa0e5](https://github.com/whatwg/url/commit/fdaa0e5a3790693a82f578d7373f216d8fef9ac8). | ||
@@ -10,0 +10,0 @@ For `file:` URLs, whose [origin is left unspecified](https://url.spec.whatwg.org/#concept-url-origin), whatwg-url chooses to use a new opaque origin (which serializes to `"null"`). |
95250
2586