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

GPHemsley commented on this pull request.

Some initial thoughts.

> + <table>
+  <tr>
+   <th>String
+   <th>Starts with a Windows drive letter
+  <tr>
+   <td>"<code>c:</code>"
+   <td>✅
+  <tr>
+   <td>"<code>c:/</code>"
+   <td>✅
+  <tr>
+   <td>"<code>c:a</code>"
+   <td>❌
+ </table>
+</div>
+

I'm not a huge fan of using symbols to represent the values of the boolean.

> @@ -1068,6 +1068,34 @@ code point is U+003A (:).
 <p class="note">As per the <a href=#url-writing>URL writing</a> section, only a
 <a>normalized Windows drive letter</a> is conforming.
 
+<p>A string
+<dfn lt="start with a Windows drive letter|starts with a Windows drive letter">starts with a Windows drive letter</dfn>
+if all of the following are true:
+
+<ul class=brief>
+ <li>its <a for=string>length</a> is greater than or equal to 2
+ <li>its first two code points are a <a>Windows drive letter</a>
+ <li>its <a for=string>length</a> is 2 or the third code point is U+002F (/), U+005C (\),

This should say "its" instead of "the" for consistency.

(Though I feel like this whole phrasing is clunky somehow...)

> @@ -1834,19 +1862,11 @@ string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, opti
        <dd>
         <ol>
          <li>
-          <p>If at least one of the following is true
-
-          <ul class=brief>
-           <li><p><a>remaining</a> consists of zero code points
-           <li><p><a>c</a> and the first code point of <a>remaining</a> are not a
-           <a>Windows drive letter</a>
-           <li><p><a>remaining</a> has at least 2 code points and <a>remaining</a>'s second code
-           point is <em>not</em> U+002F (/), U+005C (\), U+003F (?), or U+0023 (#)
-          </ul>
-
-          <p>then set <var>url</var>'s <a for=url>host</a> to <var>base</var>'s <a for=url>host</a>,
-          <var>url</var>'s <a for=url>path</a> to a copy of <var>base</var>'s <a for=url>path</a>,
-          and then <a>shorten</a> <var>url</var>'s <a for=url>path</a>.
+          <p>If the substring from <var>pointer</var> in <var>input</var> does not
+          <a>start with a Windows drive letter</a>, then set <var>url</var>'s <a for=url>host</a> to

"The substring from _pointer_ in _input_" seems incomplete to me. (I assume this is intended to imply that the substring runs until the end of the string?)

What do we gain by removing reference to _remaining_?

> @@ -1877,8 +1897,9 @@ string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, opti
 
       <ol>
        <li>
-        <p>If <var>base</var> is non-null and <var>base</var>'s <a for=url>scheme</a> is
-        "<code>file</code>", then:
+        <p>If <var>base</var> is non-null, <var>base</var>'s <a for=url>scheme</a> is
+        "<code>file</code>", and the substring from <var>pointer</var> in <var>input</var> does not
+        <a>start with a Windows drive letter</a>, then:

Same as above.

-- 
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#pullrequestreview-63193201

Received on Saturday, 16 September 2017 03:15:31 UTC