W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2013

Re: [whatwg] [URL] Cargo-cult naming in URL and matching

From: Anne van Kesteren <annevk@annevk.nl>
Date: Fri, 8 Feb 2013 12:38:33 +0000
Message-ID: <CADnb78i_JBHUafq5jLrmfE=FvitP_k6V06x19jJQNeDFbUOCQg@mail.gmail.com>
To: Alex Russell <slightlyoff@google.com>
Cc: whatwg <whatwg@lists.whatwg.org>, Jake Archibald <jakearchibald@google.com>
On Fri, Feb 8, 2013 at 12:11 PM, Alex Russell <slightlyoff@google.com> wrote:
> But if I've been vended a URL object from some API, I first have to compare
> the bases. I'd like a way to ask something like "is the full URL
> up-to-and-including this component the same?" E.g., if I have an API that's
> handed two URLs (a and b), I'd like to be able to write something like:
>     if (a.toString("path") == b.toString("path")) {
>       ...
>     }

What you're saying and what your API proposal is saying seems
different. Do you want to compare the path, or do you want to compare
the scheme, host, etc. but not query and fragment?

I've been thinking of URL.compare(url, options) where in options you
can say to ignore certain components and maybe additionally a way so
you can normalize away percent-encoding for some cases as the parser
does not do that. Thus far you're the only one who seems to be
requesting this feature. I haven't really figured out a way to
quantify demand somehow.

Received on Friday, 8 February 2013 12:38:59 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:19 UTC