Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "URL.canParse()" rather than "URL.parse()" #23639

Closed
h76oeI6pMxU9g4p8aCpc6Q opened this issue May 1, 2024 · 2 comments
Closed

Use "URL.canParse()" rather than "URL.parse()" #23639

h76oeI6pMxU9g4p8aCpc6Q opened this issue May 1, 2024 · 2 comments

Comments

@h76oeI6pMxU9g4p8aCpc6Q
Copy link

I just read the Deno 1.43 product update blog,

I saw it mentioned the new Web API "URL.parse()", but I can't found this on MDN web doc.
https://deno.com/blog/v1.43#urlparse-web-api

I found the Web API "URL.canParse()" which have similar function but return only true/false value (Boolean type)
https://developer.mozilla.org/en-US/docs/Web/API/URL/canParse_static

So, there is NOT exist a Web API named "URL.parse()" which is return null for invalid urls / return same values of URL() constructor for valid urls.

I think Deno need to replace "URL.parse()" by "URL.canParse()" on next release to meet the web standard.
This also avoid the Web API (Global scope) incompatibility of different JavaScript runtime / browser.

@crowlKats
Copy link
Member

The URL specification does have a static parse function: https://url.spec.whatwg.org/#dom-url-parse, so it is spec compiant. MDN might just not have added it yet.

@dsherret
Copy link
Member

dsherret commented May 1, 2024

This is standard, see whatwg/url#825

@dsherret dsherret closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants