Skip to content

Commit

Permalink
Editorial: clarify the "shorten a path" algorithm
Browse files Browse the repository at this point in the history
Sometimes "single" is used to mean "any" which causes a different, incorrect interpretation of this algorithm (see jsdom/whatwg-url#60). Clarify by using a more precise algorithm.
  • Loading branch information
domenic authored and annevk committed Dec 19, 2016
1 parent 373dbed commit 65dcfbc
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions url.bs
Expand Up @@ -904,11 +904,19 @@ input might be a <a>relative-URL string</a>.

<hr>

<p id=pop-a-urls-path>To <dfn local-lt=shorten>shorten a <var>url</var>'s path</dfn>, if
<var>url</var>'s <a for=url>scheme</a> is not "<code>file</code>" or <var>url</var>'s
<a for=url>path</a> does not contain a single string that is a
<a>normalized Windows drive letter</a>, remove <var>url</var>'s <a for=url>path</a>'s last string,
if any.
<p id=pop-a-urls-path>To <dfn local-lt=shorten>shorten a <var>url</var>'s path</dfn>:

<ol>
<li><p>Let <var>path</var> be <var>url</var>'s <a for=url>path</a>.

<li><p>If <var>path</var>'s <a for=list>size</a> is 0, then return.

<li><p>If <var>url</var>'s <a for=url>scheme</a> is "<code>file</code>", <var>path</var>'s
<a for=list>size</a> is 1, and <var>path</var>[0] is a <a>normalized Windows drive letter</a>, then
return.

<li><p><a for=list>Remove</a> <var>path</var>'s last item.
</ol>


<h3 id=url-syntax>URL syntax</h3>
Expand Down

0 comments on commit 65dcfbc

Please sign in to comment.