This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
http://url.spec.whatwg.org/#relative-path-start-state [[ relative path start state 1. If c is "\", parse error. 2. Set state to relative path state and if c is neither "/" nor "\", decrease pointer by one. relative path state 1. If either c is one of EOF code point, "/", and "\", or state override is not given and c is one of "?" and "#", run these substeps: 1. If buffer is ".." and c is one of EOF code point, "/", and "\", pop url's path, if non-empty, and then append the empty string to it. 2. Otherwise, if buffer is "..", pop url's path, if non-empty. 3. Otherwise, if buffer is "." and c is one of EOF code point, "/", and "\", append an empty string to url's path. 4. Otherwise, if buffer is not ".", run these subsubsteps: ]] I suggest the following changes to that text: ----------------------- relative path start state 2. Set state to relative path state and decrease pointer by one. ----- relative path state 1. [...] 1. If buffer is "..", pop url's path, if non-empty, then if c is neither "/" nor "\", append the empty string to url's path. 2. Otherwise, if buffer is "." and c is neither "/", nor "\", append an empty string to url's path. 3. Otherwise, if buffer is neither ".." nor ".", run these subsubsteps [...] ----------------------- With these changes, I believe the following test cases will pass: /x/w/../y -> /x/y /x/w/.. -> /x/ /x/w/..#z -> /x/#z ////../.. -> // /x/x/x/../.. -> /x/ /x/../y -> /y /x/.. -> / /x/..#z -> /#z /../y -> /y /.. -> / /..#z -> /#z /x/./y -> /x/y /x/. -> /x/ /x/.#z -> /x/#z /./y -> /y /. -> / /.#z -> /#z
I take back the changes to the relative path start state. The rest of my message still stands.
So the \ and / should've been ? and #. But your proposed text is shorter so I've gone with that. Also added the missing parse error for \. I did not add the additional check for ".." as that's redundant with the usage of otherwise. https://github.com/whatwg/url/commit/b3fd683a3907e379ffc1469beee79d8e469b61a8