[whatwg/url] A branch of the "ends in a number checker" cannot be hit (Issue #865)

domenic created an issue (whatwg/url#865)

### What is the issue with the URL Standard?

https://url.spec.whatwg.org/#ends-in-a-number-checker

> 2. If the last [item](https://infra.spec.whatwg.org/#list-item) in parts is the empty string, then:
>
>     1. If parts’s [size](https://infra.spec.whatwg.org/#list-size) is 1, then return false.

This can only be true if the input is the empty string. However, the empty string is never fed to the "ends in a number checker":

- https://url.spec.whatwg.org/#ref-for-ends-in-a-number-checker call site only feeds it the result of "domain to ASCII"
- https://url.spec.whatwg.org/#concept-domain-to-ascii asserts that the result is not the empty string before returning.

Transforming this branch into an assert might be good. Or, if we want to keep the "ends in a number checker" generic, maybe a note explaining this would be good.

(Found while working on https://github.com/jsdom/whatwg-url/issues/268)

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

Message ID: <whatwg/url/issues/865@github.com>

Received on Saturday, 15 March 2025 01:40:47 UTC