- From: Glenn Maynard <glenn@zewt.org>
- Date: Fri, 8 Feb 2013 09:03:39 -0600
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: whatwg <whatwg@lists.whatwg.org>, Jake Archibald <jakearchibald@google.com>, Alex Russell <slightlyoff@google.com>
On Fri, Feb 8, 2013 at 6:38 AM, Anne van Kesteren <annevk@annevk.nl> wrote: > 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. > A compare method is probably useful, since you'd also want case-insensitive comparisons for some parts and not others (eg. lowercase protocol and host before comparing). Comparing only certain components doesn't seem very common, though, and simple for people to do themselves: function get_url_path(url) { url = new URL(url); url.search = ""; url.hash = ""; return url; } if(get_url_path(url1).toString() == get_url_path(url2).toString()) ; -- Glenn Maynard
Received on Friday, 8 February 2013 15:04:07 UTC