[whatwg/url] Creating a valid URL object and then changing the href to an invalid URL should not work (#470)

When I create a URL object, this works:
`new URL("https://google.com")`
but this doesn't:
`new URL("google.com")`
because it throws a **TypeError** `Failed to construct URL: Invalid URL`
I presume this is because of the missing protocol.

But, if I create a URL object with a valid URL: `urlObj = new URL("https://google.com")`
And then modify the internal URL string: `urlObj.href = "abcd"`
It succeeds and I now have a URL object with a string that is definitely not a valid URL.

Is this by design, or can it be fixed?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/470

Received on Monday, 23 March 2020 11:18:01 UTC