Skip to content

Use URL instead of creating an <a> tag #7

@philipwalton

Description

@philipwalton

All browsers that support modules also support the URL API, so I don't see any reason to use the <a> tag just to convert a relative URL to an absolute one.

Your toAbsoluteURL() function could be removed and you could update the usage as follows:

- const absURL = toAbsoluteURL(url);
+ const absURL = new URL(url, location).href;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions