W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2015

Re: URL and host comparison methods

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Mon, 17 Aug 2015 08:26:28 -0700
Message-ID: <CABZUbM0DzGa3b6H_wQ2rAdxoGGoB5yiZSHp_D2e-sjOUChRLWQ@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: public-script-coord <public-script-coord@w3.org>
On 8/17/15, 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.)
>
>
So do document.writeln and System.out.println.

It is preferable to put the boolean indicator "is", "are", "can",
"has", etc in the beginning of the function's name, and not at the
end. For example: areEqual, isEqual, areComparable, areSame, etc.
-- 
Garrett
@xkit
ChordCycles.wordpress.com
garretts.github.io
personx.tumblr.com
Received on Monday, 17 August 2015 15:26:56 UTC

This archive was generated by hypermail 2.3.1 : Monday, 17 August 2015 15:26:56 UTC