Re: [whatwg/url] "append the empty string to url’s path." is confusing (#295)

> Also, consider the effect of parsing `/././././`.

The first `/` will be parsed in one of the states other than path state, but after processing that character the state will be switched to path state.

The first `.` enters the second branch of path state, and _buffer_ is now `.` since it doesn't need to be encoded.

The second `/` will trigger the first branch in path state, but inside that branch it will skip directly to step 5, and url's path is not changed at all.

Repeat the last two steps for all code points in that input.

After parsing the last `/`, _c_ is the EOF code point, and since _buffer_ is empty, branch 1, step 4 of path state will be taken. An empty string is appended to url's path. And thus ends the state machine.

So in the end the input results in url's path being a list containing a single empty string, which returns `/` in the [URL serialization](https://url.spec.whatwg.org/commit-snapshots/488c459d9e4245a3f6bf087e7dcd2c7e91487ac5/#concept-url-serializer) algorithm.

-- 
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/295#issuecomment-296253428

Received on Friday, 21 April 2017 17:29:00 UTC