diff --git a/url.bs b/url.bs index d42a97b..fe2f9f3 100644 --- a/url.bs +++ b/url.bs @@ -3327,6 +3327,7 @@ are encouraged to use an API suitable to their needs, which might not be this on interface URL { constructor(USVString url, optional USVString base); + static URL? parse(USVString url, optional USVString base); static boolean canParse(USVString url, optional USVString base); stringifier attribute USVString href; @@ -3389,8 +3390,29 @@ null-or-scalar value string base (default null), and then runs parsedBase. +
To initialize a {{URL}} object url with a URL +urlRecord: + +
Let query be urlRecord's query, if that is non-null; + otherwise the empty string. + +
Set url's URL to urlRecord. + +
Set url's query object to a new {{URLSearchParams}} object. + +
Initialize url's query object with + query. + +
Set url's query object's URL object to + url. +
The
new URL(url, base)
constructor steps are:
@@ -3401,19 +3423,9 @@ constructor steps are:
If parsedURL is failure, then throw a {{TypeError}}. -
Let query be parsedURL's query, if that is non-null, - and the empty string otherwise. - -
Set this's query object to a new {{URLSearchParams}} object. - -
Initialize this's query object with - query. - -
Set this's query object's URL object to - this. +
Initialize this with parsedURL. +
To parse a string into a URL without using a @@ -3450,6 +3462,24 @@ url.pathname // "/%F0%9F%8F%B3%EF%B8%8F%E2%80%8D%F0%9F%8C%88"
The static parse(url, base)
method
+steps are:
+
+
Let parsedURL be the result of running the API URL parser on + url with base, if given. + +
If parsedURL is failure, then return null. + +
Let url be a new {{URL}} object. + +
Initialize url with parsedURL. + +
Return url. +
The static canParse(url, base)
method steps are: