After a bit of investigation, I notice that the WHATWG URL Standard treats the rootless path in foo:.///bar as opaque and does not require any dot segments to be removed from it: 2.8, 2.9 of scheme state; Live URL Viewer. So, I believe that the WHATWG spec is irrelevant when it comes to whether to preserve the relativity of paths or not, which brings us back to RFC 3986.
The primary goal of the string types in iri-string crates is being compliant to RFC 3986 and RFC 3987, and then I attempt to use WHATWG URL Standard supplementarily to deal with incompleteness of RFC 3986/3987.
So foo:./bar being normalized into foo:bar is expected result (according to RFC 3986) while WHATWG URL Standard requires the path to be treated as "opaque".
However, foo:.///bar/./baz being normalized into foo:/.//bar/baz is compliant to neither RFC 3986 nor WHATWG URL Standard.
(RFC 3986 will (erronously) expect foo://bar/baz, and WHATWG URL Standard requires foo:.///bar/./baz as reported above.)
Result according to WHATWG URL Standard foo:.///bar/./baz does not seem to be consistent to expected result according to RFC 3986 (the ideal path //bar/baz), so I should clearly define the behavior in this case and make an effort to make behavior consistent.
The primary goal of the string types in iri-string crates is being compliant to RFC 3986 and RFC 3987, and then I attempt to use WHATWG URL Standard supplementarily to deal with incompleteness of RFC 3986/3987. So
foo:./bar
being normalized intofoo:bar
is expected result (according to RFC 3986) while WHATWG URL Standard requires the path to be treated as "opaque".However,
foo:.///bar/./baz
being normalized intofoo:/.//bar/baz
is compliant to neither RFC 3986 nor WHATWG URL Standard. (RFC 3986 will (erronously) expectfoo://bar/baz
, and WHATWG URL Standard requiresfoo:.///bar/./baz
as reported above.)Result according to WHATWG URL Standard
foo:.///bar/./baz
does not seem to be consistent to expected result according to RFC 3986 (the ideal path//bar/baz
), so I should clearly define the behavior in this case and make an effort to make behavior consistent.