Re: [whatwg/url] Fix Windows drive letter handling in the file slash state (#343)

> Just editorial feedback. I haven't reviewed the new behavior in detail. Did you look at various implementations?

I tested this new behavior on patched https://github.com/jsdom/whatwg-url and it passes all the tests.
I can prepare PR.

> Do we need to say the substring from pointer onward? We also haven't really defined substring. Not sure if that's problematic.

Yes. A substring isn't defined in this spec., but it's already used to define [**remaining**](https://url.spec.whatwg.org/#remaining).

Yet another approach is not to use a substring here, for example I created such function for testing:

```javascript
const fileOtherwiseCodePoints = new Set([p("/"), p("\\"), p("?"), p("#")]);
 
function startsWithWindowsDriveLetter(input, pointer) {
  const length = input.length - pointer;
  return length >= 2 &&
    isWindowsDriveLetterCodePoints(input[pointer], input[pointer + 1]) &&
    (length === 2 || fileOtherwiseCodePoints.has(input[pointer + 2]));
}
```

-- 
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/pull/343#issuecomment-329081459

Received on Wednesday, 13 September 2017 07:21:41 UTC