Re: [whatwg/url] Add URL path equality and prefix comparison (PR #929)

@annevk commented on this pull request.



> + <li><p>If <var>A</var> is a <a for=/>URL path segment</a> or <var>B</var> is a
+ <a for=/>URL path segment</a>, then return false.
+
+ <li><p>If <var>B</var>'s <a for=list>size</a> is greater than <var>A</var>'s
+ <a for=list>size</a>, then return false.
+
+ <li><p><a for=list>For each</a> <var>index</var> of <var>B</var>'s <a for=list>indices</a>: if
+ <var>A</var>[<var>index</var>] is not <var>B</var>[<var>index</var>], then return false.
+
+ <li><p>Return true.
+</ol>
+
+<p class=note>As <a for=/>URL path segments</a> never contain U+002F (/), this can only be true when
+<var>B</var> covers whole segments of <var>A</var>. That makes it suitable for deciding whether one
+<a for=/>URL path</a> is contained by another, which comparing serializations is not: the
+serialization of « "<code>foo</code>" » is a prefix of that of « "<code>foobar</code>" ».

This is great. I've reused a bunch of your suggested words here.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/pull/929#discussion_r3950067109
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/pull/929/review/5132389005@github.com>

Received on Monday, 7 September 2026 13:14:37 UTC