WICG / import-maps

How to control the behavior of JavaScript imports
https://html.spec.whatwg.org/multipage/webappapis.html#import-maps
Other
2.68k stars 69 forks source link

longer-or-code-unit-less-than is not a total order #181

Closed hiroshige-g closed 4 years ago

hiroshige-g commented 4 years ago

The order used to sort scope keys etc., i.e. https://wicg.github.io/import-maps/#longer-or-code-unit-less-than

if a’s length is greater than b’s length, or if a is code unit less than b.

is not a total order. For example,

Probably this should be something like

if a’s length is greater than b’s length, or if a’s length is equal to b’s length and a is code unit less than b.

or simply

if b is code unit less than a.

Probably the latter one is better, because it's simple to understand and implement. I'll create a PR shortly.

(Memo: code unit less than also seems to have a spec bug)