Skip to content

Commit

Permalink
Correct parse/url const
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee committed Apr 29, 2024
1 parent ad8f95f commit 2f6ce44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions files/en-us/web/api/url/parse_static/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ URL.parse(url, base)
- : A string representing the base URL to use in cases where `url` is a relative URL.
If not specified, it defaults to `undefined`.

When using a `base`, the resulting URL is not simply a concatenation of `url` and `base`.
For example, the scheme and domain of the `base` are used for resolving `url`, but any URL path after the last backslash, a given port, or query parameters, are not used.
When specify a `base` URL, the resolved URL is not simply a concatenation of `url` and `base`.
Parent-relative and current-directory-relative URLS are relative to the current directory of the `base` URL, which includes only path segments up until the last forward-slash, but not any after.
Root-relative URLs are relative to the base origin.
For more information see [Resolving relative URLs](/en-US/docs/Web/API/URL_API/Resolving_relative_urls).

> **Note:** The `url` and `base` arguments will each be stringified from whatever value you pass, such as an {{domxref("HTMLAnchorElement")}} or {{domxref("HTMLAreaElement")}} element, just like with other Web APIs that accept a string.
Expand Down
5 changes: 3 additions & 2 deletions files/en-us/web/api/url/url/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ new URL(url, base)
- : A string representing the base URL to use in cases where `url` is a relative URL.
If not specified, it defaults to `undefined`.

When using a `base`, the resulting URL is not simply a concatenation of `url` and `base`.
For example, the scheme and domain of the `base` are used for resolving `url`, but any URL path after the last backslash, a given port, or query parameters, are not used.
When specify a `base` URL, the resolved URL is not simply a concatenation of `url` and `base`.
Parent-relative and current-directory-relative URLS are relative to the current directory of the `base` URL, which includes path segments up until the last forward-slash, but not any after.
Root-relative URLs are relative to the base origin.
For more information see [Resolving relative URLs](/en-US/docs/Web/API/URL_API/Resolving_relative_urls).

> **Note:** The `url` and `base` arguments will each be stringified from whatever value you pass, such as an {{domxref("HTMLAnchorElement")}} or {{domxref("HTMLAreaElement")}} element, just like with other Web APIs that accept a string.
Expand Down

0 comments on commit 2f6ce44

Please sign in to comment.