Skip to content

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

@h76oeI6pMxU9g4p8aCpc6Q

Description

@h76oeI6pMxU9g4p8aCpc6Q

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions