- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 18 Aug 2015 14:25:48 -0700
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: public-script-coord <public-script-coord@w3.org>
On Mon, Aug 17, 2015 at 7:55 AM, Anne van Kesteren <annevk@annevk.nl> wrote: > For the URL API we're considering introducing comparison methods. That > take two strings and some options, and then return whether they're > equal or not given those options. > > URLs frequently want to be compared while ignoring the fragment identifier. > > Hosts sometimes need to be compared without the trailing dot. Suggested API: > > URL.is(url1, url2, { excludeHash: true }) > URL.hostIs(host1, host2, { excludeTrailingDot: true }) > > (Typing it out I notice it is somewhat unfortunate about I and l not > being distinguishable much, but getElementById() already has that > problem.) Foo.isFoo() is idiomatically used as an instance tester. That's not quite URL.is(), but it's close enough that it might be good to use different names. Why not .matches() and .hostMatches()? You're *comparing* two urls, after all. ~TJ
Received on Tuesday, 18 August 2015 21:26:37 UTC