diff --git a/url.bs b/url.bs index d42a97b..9381f69 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: + +

    +
  1. Let query be urlRecord's query, if that is non-null; + otherwise the empty string. + +

  2. Set url's URL to urlRecord. + +

  3. Set url's query object to a new {{URLSearchParams}} object. + +

  4. Initialize url's query object with + query. + +

  5. 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 URL to parsedURL. - -

  • 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: + +

      +
    1. Let parsedURL be the result of running the API URL parser on + url with base, if given. + +

    2. If parsedURL is failure, then return null. + +

    3. Let url be a new URL object. + +

    4. Initialize url with parsedURL. + +

    5. Return url. +

    +
    +

    The static canParse(url, base) method steps are: