Re: [whatwg/url] Add `URL.from(object)` constructor? (Issue #782)

alwinb left a comment (whatwg/url#782)

This proposal is also relevant to #797 #704 and #811.

We should identify all the invariants on the structure, and contents of the URL record, and make them tightly match the definitions of failure vs validity (and error correction).

For the contents of components that contain percent encoded strings (e.g. username, password, opaque-hosts, path segments, query and fragment) I've charted them out (#855) and [here][1].

Also notable: in [URLReference] I enforce less of the structural / cross component expectations that URLs have (but still some) so they can function as URL builders more effectively.

What karwa is getting at is good in my opinion. We can start to aim for an inductive proof of validity and absence of reparse bugs.

[1]: https://alwinb.github.io/url-specification/#component-characters
[URLReference]: https://github.com/alwinb/url-reference/

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

Message ID: <whatwg/url/issues/782/2700901181@github.com>

Received on Wednesday, 5 March 2025 13:16:04 UTC