Re: [whatwg] New URL Standard

2012-10-06 Thread Glenn Maynard
On Tue, Sep 25, 2012 at 10:25 PM, Ian Hickson wrote: > You could even make that work, by having a special method for appending a > new key/value pair, and just not making it accessible. > Right, other access methods, like this or a classList-like array, can always be added later. (Actually, ke

Re: [whatwg] New URL Standard

2012-09-25 Thread Ian Hickson
On Tue, 25 Sep 2012, Glenn Maynard wrote: > > What this doesn't allow is creating things like "a=1&b=2&a=3". You can > create "a=1&a=2&b=3" (url.query.a = ["1","2"]; url.query.b = "3"), but > there's no way to split the keys (a, b, a). This is the limitation we > were really talking about. T

Re: [whatwg] New URL Standard

2012-09-25 Thread Boris Zbarsky
On 9/25/12 11:15 PM, Glenn Maynard wrote: What this doesn't allow is creating things like "a=1&b=2&a=3" Ah. That should be relatively unlikely (though forms with checkboxes in them can in fact lead to query strings like that). -Boris

Re: [whatwg] New URL Standard

2012-09-25 Thread Glenn Maynard
On Tue, Sep 25, 2012 at 9:53 PM, Boris Zbarsky wrote: > On 9/25/12 10:36 PM, Glenn Maynard wrote: > >> You usually don't care about the resulting order in that case, right? >> > > It's not uncommon for servers to depend on a particular order of > parameters in the query string and totally fail wh

Re: [whatwg] New URL Standard

2012-09-25 Thread Boris Zbarsky
On 9/25/12 10:36 PM, Glenn Maynard wrote: You usually don't care about the resulting order in that case, right? It's not uncommon for servers to depend on a particular order of parameters in the query string and totally fail when the ordering is different. Especially the sort of servers that

Re: [whatwg] New URL Standard

2012-09-25 Thread Glenn Maynard
On Tue, Sep 25, 2012 at 9:27 PM, Boris Zbarsky wrote: > On 9/25/12 10:13 PM, Glenn Maynard wrote: > >> The obvious use case is constructing a URI with a given query by >> hand, right? >> >> If you already have the "a=1&b=2" string, you can just assign it to >> .search and not use the prep

Re: [whatwg] New URL Standard

2012-09-25 Thread Boris Zbarsky
On 9/25/12 10:13 PM, Glenn Maynard wrote: The obvious use case is constructing a URI with a given query by hand, right? If you already have the "a=1&b=2" string, you can just assign it to .search and not use the prepared-query-parameters interface at all. I was thinking more like you h

Re: [whatwg] New URL Standard

2012-09-25 Thread Glenn Maynard
On Tue, Sep 25, 2012 at 8:36 PM, Boris Zbarsky wrote: > On 9/25/12 6:53 PM, Glenn Maynard wrote: > >> (Of course, a separate method could exist to get access to the underlying >> order, if and when real use cases turn up that actually need it, and it's >> not unlikely that there are use cases--bu

Re: [whatwg] New URL Standard

2012-09-25 Thread Boris Zbarsky
On 9/25/12 6:53 PM, Glenn Maynard wrote: (Of course, a separate method could exist to get access to the underlying order, if and when real use cases turn up that actually need it, and it's not unlikely that there are use cases--but so far they haven't been raised. The obvious use case is constr

Re: [whatwg] New URL Standard

2012-09-25 Thread Glenn Maynard
On Tue, Sep 25, 2012 at 5:14 PM, David Sheets wrote: > Looking up keys is easy in an association list. Filtering the list > retains ordering. Appending to the list is well-defined. Folding into > a dictionary is trivial and key merging can be defined according to > the author's URL convention. >

Re: [whatwg] New URL Standard

2012-09-25 Thread Alexandre Morgaut
On 26 sept. 2012, at 00:14, David Sheets wrote: > On Tue, Sep 25, 2012 at 2:13 PM, Glenn Maynard wrote: >> On Mon, Sep 24, 2012 at 7:18 PM, David Sheets wrote: >>> > >> The right approach is probably to expose the results in an object-like form, >> as Tab suggests, but to store the state intern

Re: [whatwg] New URL Standard

2012-09-25 Thread David Sheets
On Tue, Sep 25, 2012 at 2:13 PM, Glenn Maynard wrote: > On Mon, Sep 24, 2012 at 7:18 PM, David Sheets wrote: >> >> Always. The appropriate interface is (string * string?) list. Id est, >> >> an association list of keys and nullable values (null is >> key-without-value and empty string is empty-va

Re: [whatwg] New URL Standard

2012-09-25 Thread Glenn Maynard
On Mon, Sep 24, 2012 at 7:18 PM, David Sheets wrote: > Always. The appropriate interface is (string * string?) list. Id est, > an association list of keys and nullable values (null is > key-without-value and empty string is empty-value). If you prefer to > not use a nullable value and don't like

Re: [whatwg] New URL Standard

2012-09-25 Thread Anne van Kesteren
On Tue, Sep 25, 2012 at 8:20 PM, David Sheets wrote: > On Tue, Sep 25, 2012 at 8:03 AM, Anne van Kesteren wrote: >> FWIW, given that browsers happily do requests to servers with >> characters in the URL that are "invalid" per the RFC (they are not URL >> escaped) and servers handle them fine I th

Re: [whatwg] New URL Standard

2012-09-25 Thread Ian Hickson
On Tue, 25 Sep 2012, David Sheets wrote: > > > > Not necessarily, but that's certainly possible. Personally I would > > recommend that we not change the definition of what is conforming from > > the current RFC3986/RFC3987 rules, except to the extent that the > > character encoding affects it (a

Re: [whatwg] New URL Standard

2012-09-25 Thread David Sheets
On Tue, Sep 25, 2012 at 8:03 AM, Anne van Kesteren wrote: > On Tue, Sep 25, 2012 at 6:18 AM, Ian Hickson wrote: >> Not necessarily, but that's certainly possible. Personally I would >> recommend that we not change the definition of what is conforming from the >> current RFC3986/RFC3987 rules, exc

Re: [whatwg] New URL Standard

2012-09-25 Thread David Sheets
On Mon, Sep 24, 2012 at 9:18 PM, Ian Hickson wrote: > > This is Anne's spec, so I'll let him give more canonical answers, but: > > On Mon, 24 Sep 2012, David Sheets wrote: >> >> Your conforming WHATWG-URL syntax will have production rule alphabets >> which are supersets of the alphabets in RFC3986

Re: [whatwg] New URL Standard

2012-09-25 Thread Anne van Kesteren
On Tue, Sep 25, 2012 at 6:18 AM, Ian Hickson wrote: > Not necessarily, but that's certainly possible. Personally I would > recommend that we not change the definition of what is conforming from the > current RFC3986/RFC3987 rules, except to the extent that the character > encoding affects it (as p

Re: [whatwg] New URL Standard

2012-09-25 Thread Silvia Pfeiffer
On Tue, Sep 25, 2012 at 9:48 PM, Robin Berjon wrote: > On 25/09/2012 01:07 , Glenn Maynard wrote: >> >> On Mon, Sep 24, 2012 at 12:30 PM, Tab Atkins Jr. >> wrote: >>> >>> I suggest just making it a map from String->[String]. You probably >>> want a little bit of magic - if the setter receives an

Re: [whatwg] New URL Standard

2012-09-25 Thread Alexandre Morgaut
On 25 sept. 2012, at 13:48, Robin Berjon wrote: > On 25/09/2012 01:07 , Glenn Maynard wrote: > And round-tripping using ; as the separator instead of &. I mention this > because I've seen actual production code (more than once) that relied on > this. I have no idea how common it is though. I'm gu

Re: [whatwg] New URL Standard

2012-09-25 Thread Robin Berjon
On 25/09/2012 01:07 , Glenn Maynard wrote: On Mon, Sep 24, 2012 at 12:30 PM, Tab Atkins Jr. wrote: I suggest just making it a map from String->[String]. You probably want a little bit of magic - if the setter receives an array, replace the current value with it; anything else, stringify then wr

Re: [whatwg] New URL Standard

2012-09-24 Thread Ian Hickson
This is Anne's spec, so I'll let him give more canonical answers, but: On Mon, 24 Sep 2012, David Sheets wrote: > > Your conforming WHATWG-URL syntax will have production rule alphabets > which are supersets of the alphabets in RFC3986. Not necessarily, but that's certainly possible. Personall

Re: [whatwg] New URL Standard

2012-09-24 Thread David Sheets
On Mon, Sep 24, 2012 at 5:23 PM, Ian Hickson wrote: > On Mon, 24 Sep 2012, David Sheets wrote: >> >> Is there an issue with defining WHATWG-URL syntax as a grammar extension >> to the URI syntax in RFC3986? > > In general, BNF isn't very useful for defining the parsing rules when you > also need t

Re: [whatwg] New URL Standard

2012-09-24 Thread Ian Hickson
On Mon, 24 Sep 2012, David Sheets wrote: > > Is there an issue with defining WHATWG-URL syntax as a grammar extension > to the URI syntax in RFC3986? In general, BNF isn't very useful for defining the parsing rules when you also need to handle non-conforming content in a correct manner. Really

Re: [whatwg] New URL Standard

2012-09-24 Thread David Sheets
On Mon, Sep 24, 2012 at 4:07 PM, Glenn Maynard wrote: > On Mon, Sep 24, 2012 at 12:30 PM, Tab Atkins Jr. wrote: > >> I suggest just making it a map from String->[String]. You probably >> want a little bit of magic - if the setter receives an array, replace >> the current value with it; anything e

Re: [whatwg] New URL Standard

2012-09-24 Thread Glenn Maynard
On Mon, Sep 24, 2012 at 12:30 PM, Tab Atkins Jr. wrote: > I suggest just making it a map from String->[String]. You probably > want a little bit of magic - if the setter receives an array, replace > the current value with it; anything else, stringify then wrap in an > array and replace the curren

Re: [whatwg] New URL Standard

2012-09-24 Thread David Sheets
On Mon, Sep 24, 2012 at 2:34 AM, Anne van Kesteren wrote: > On Sat, Sep 22, 2012 at 9:10 AM, Alexandre Morgaut > wrote: >> Shouldn't this document have references on some of the URL related RFCs: > > The plan is to obsolete the RFCs. But yes, I will add some references > in the Goals section mos

Re: [whatwg] New URL Standard

2012-09-24 Thread Tab Atkins Jr.
On Mon, Sep 24, 2012 at 2:34 AM, Anne van Kesteren wrote: > I have been thinking about introducing a .query attribute that would > return a special interface for this purpose, but what the right API > should be seems somewhat tricky. Adam and Erik came up with a solution > that introduces eight ne

Re: [whatwg] New URL Standard

2012-09-24 Thread Boris Zbarsky
On 9/24/12 4:58 AM, Anne van Kesteren wrote: Say you have ; the concern is what e.g. a.protocol and a.pathname would return here. For invalid URLs they would return ":" and "" respectively. If we treat this as a valid URL you would get "data:" and "test". In Gecko I get "http:" and "". If I make

Re: [whatwg] New URL Standard

2012-09-24 Thread Jukka K. Korpela
2012-09-24 15:26, Karl Dubost wrote: Le 24 sept. 2012 à 12:08, Jukka K. Korpela a écrit : It also means that the only immediately available source information for a quotation will be an ISBN in URL format. So, for example, working offline, you won't see even the title and the author. Would th

Re: [whatwg] New URL Standard

2012-09-24 Thread Karl Dubost
Le 24 sept. 2012 à 12:08, Jukka K. Korpela a écrit : > It also means that the only immediately available source information for a > quotation will be an ISBN in URL format. So, for example, working offline, > you won't see even the title and the author. Would the quotation even satisfy > the le

Re: [whatwg] New URL Standard

2012-09-24 Thread Alexandre Morgaut
On 24 sept. 2012, at 14:08, Alexandre Morgaut wrote: > > sms:+15105550101?body=hello%20there > > { >host: "+15105550101", >hostname: "+15105550101", >href: "+15105550101?body=hello%20there", >parameters: { >body: "hello there" >} >pa

Re: [whatwg] New URL Standard

2012-09-24 Thread Alexandre Morgaut
On 24 sept. 2012, at 11:34, Anne van Kesteren wrote: >> Could the search property have a key/value mapping? >> ex: >> http://test.com?param1=value1 >> -> var value1 = url.search.param1 >> "search" as "window.location" could still be usable as a string > > I have been thinking about introducing a

Re: [whatwg] New URL Standard

2012-09-24 Thread Jukka K. Korpela
2012-09-24 12:47, Karl Dubost wrote: On cite attributes, I'm using urn:isbn: J'aime la liberté. J'aime être responsable de mes actes. J'aime comprendre ce que je fais… Et, cependant, je donne mon accord à ce marché bizarre. Which I can use and parse with an extension

Re: [whatwg] New URL Standard

2012-09-24 Thread Karl Dubost
Le 21 sept. 2012 à 17:16, Anne van Kesteren a écrit : > I took a crack at defining URLs: http://url.spec.whatwg.org/ Very cool. On cite attributes, I'm using urn:isbn: J'aime la liberté. J'aime être responsable de mes actes. J'aime comprendre ce que je fais… Et, cependant, j

Re: [whatwg] New URL Standard

2012-09-24 Thread Anne van Kesteren
On Sat, Sep 22, 2012 at 9:10 AM, Alexandre Morgaut wrote: > Would the URLUtil interface replace the "URL decomposition IDL attributes" of > the Location interface? > -> > http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#url-decomposition-idl-attributes > ->

Re: [whatwg] New URL Standard

2012-09-24 Thread Tobie Langel
On Mon, Sep 24, 2012 at 10:58 AM, Anne van Kesteren wrote: > The kind of predictability we have for the HTML parser, I want to have for the > URL parser as well. Yes, please!! --tobie

Re: [whatwg] New URL Standard

2012-09-24 Thread Anne van Kesteren
On Fri, Sep 21, 2012 at 5:36 PM, Boris Zbarsky wrote: > On 9/21/12 11:16 AM, Anne van Kesteren wrote: >> * data URLs; in Gecko these appear to be parsed as part of the URL >> layer, because they can turn a URL invalid. Other browsers do not do >> this. Opinions? Should data URLs support .search? >

Re: [whatwg] New URL Standard

2012-09-23 Thread Maciej Stachowiak
Excellent work. Did you use tests while making this and if so did you save them? It might be worthwhile to check all the browsers against the spec. Cheers, Maciej On Sep 21, 2012, at 8:16 AM, Anne van Kesteren wrote: > I took a crack at defining URLs: http://url.spec.whatwg.org/ > > At the

Re: [whatwg] New URL Standard

2012-09-22 Thread Alexandre Morgaut
Thanks Anne, I'd appreciate to be able to easily get a URLUtil interface from a string UTL without doing some nasty hacks I have a ew questions Would the URLUtil interface replace the "URL decomposition IDL attributes" of the Location interface? -> http://www.whatwg.org/specs/web-apps

Re: [whatwg] New URL Standard

2012-09-21 Thread Julian Reschke
On 2012-09-21 17:16, Anne van Kesteren wrote: I took a crack at defining URLs: http://url.spec.whatwg.org/ At the moment it defines parsing (minus domain names / IP addresses) and the JavaScript API (minus the query manipulation methods proposed by Adam Barth). It defines things like setting .pa

Re: [whatwg] New URL Standard

2012-09-21 Thread Boris Zbarsky
On 9/21/12 11:16 AM, Anne van Kesteren wrote: It is based on the various URL code paths found in WebKit and Gecko and supports the \ as / in various places because it seemed better for compatibility. Or worse, depending on your use cases... * data URLs; in Gecko these appear to be parsed as p

[whatwg] New URL Standard

2012-09-21 Thread Anne van Kesteren
I took a crack at defining URLs: http://url.spec.whatwg.org/ At the moment it defines parsing (minus domain names / IP addresses) and the JavaScript API (minus the query manipulation methods proposed by Adam Barth). It defines things like setting .pathname to "hello world" (notice the space), it d