whatwg-url icon indicating copy to clipboard operation
whatwg-url copied to clipboard

Implement `URL.parse`

Open filiptronicek opened this issue 5 months ago • 0 comments

About 5 months ago in https://github.com/whatwg/url/commit/58acb06dccec3e95a33d842337e61d25195d4b1b, the static method URL.parse was added to the spec.

Quoting from MDN:

The URL.parse() static method of the URL interface returns a newly created URL object representing the URL defined by the parameters. If the given base URL or the resulting URL are not parsable and valid URLs, null is returned. This is an alternative to using the URL() constructor to construct a URL within a try...catch block, or using canParse() to check the parameters and returning null if the method returns false.

It seems like a useful addition to the API and has been shipped so far by Chrome and Firefox, with pending experiments from Safari and Opera.

filiptronicek avatar Aug 27 '24 08:08 filiptronicek