Re: A URL API

2010-12-07 Thread Jonas Sicking
On Fri, Sep 17, 2010 at 11:05 AM, Adam Barth w...@adambarth.com wrote: On Fri, Sep 17, 2010 at 10:27 AM, Adam Barth w...@adambarth.com wrote: On Thu, Sep 16, 2010 at 3:25 PM, Darin Fisher da...@chromium.org wrote: On Thu, Sep 16, 2010 at 6:31 AM, Julian Reschke julian.resc...@gmx.de wrote:

Re: A URL API

2010-10-10 Thread timeless
On Mon, Sep 20, 2010 at 9:27 AM, Adam Barth w...@adambarth.com wrote: On Sun, Sep 19, 2010 at 10:48 PM, Devdatta Akhawe dev.akh...@gmail.com wrote: 1) There are now two methods for getting at the URL parameters.  The and none for setting them? That's correct.  Looking at various libraries,

Re: A URL API

2010-09-24 Thread Devdatta Akhawe
If you really don't want to care what happened before, either do a clearParameter every time first, or define your own setParameter that just clears then appends.  Append/clear is a cleaner API design in general imo, precisely because you don't have to worry about colliding with previous

Re: A URL API

2010-09-24 Thread Tab Atkins Jr.
On Wed, Sep 22, 2010 at 12:54 AM, Devdatta Akhawe dev.akh...@gmail.com wrote: 2) I've added two flavors of appendParameter.  The first flavor takes a DOMString for a value and appends a single parameter.  The second flavor takes an array of DOMStrings and appends one parameter for each array.  

Re: A URL API

2010-09-22 Thread Adam Barth
On Sun, Sep 19, 2010 at 10:50 PM, Darin Fisher da...@chromium.org wrote: On Sun, Sep 19, 2010 at 10:41 PM, Boris Zbarsky bzbar...@mit.edu wrote:  * A getCommonBaseSpec() method that will take two URIs and return a    URI string they could both be relative to, if any.  * A getRelativeSpec()

Re: A URL API

2010-09-22 Thread Devdatta Akhawe
2) I've added two flavors of appendParameter.  The first flavor takes a DOMString for a value and appends a single parameter.  The second flavor takes an array of DOMStrings and appends one parameter for each array.  This seemed better than using a variable number of arguments. -1 I really

Re: A URL API

2010-09-21 Thread Darin Fisher
On Mon, Sep 20, 2010 at 11:02 AM, Garrett Smith dhtmlkitc...@gmail.comwrote: On 9/20/10, Julian Reschke julian.resc...@gmx.de wrote: On 20.09.2010 18:56, Garrett Smith wrote: [...] Requests that don't have lot of parameters are often simple one-liners: url = /getShipping/?zip= + zip +

Re: A URL API

2010-09-21 Thread Devdatta Akhawe
or any webservice that likes to have lots of query parameters - Google Search for example. In general, why would you not want a robust way to make complicated queries - those who are making simple queries and prefer simple one liners can continue using it. On 20 September 2010 23:42, Darin

Re: A URL API

2010-09-21 Thread Adam Barth
Ok. I'm sold on having an API for constructing query parameters. Thoughts on what it should look like? Here's what jQuery does: http://api.jquery.com/jQuery.get/ Essentially, you supply a JSON object containing the parameters. They also have some magical syntax for specifying multiple

Re: A URL API

2010-09-21 Thread Devdatta Akhawe
+1 for 2 APIs - this whole multiple parameters with the same value is too annoying imho and unnecessary for new web services . It should be there only for old services that are also accessed via basic HTML forms cheers devdatta On 20 September 2010 23:56, Adam Barth w...@adambarth.com wrote:

Re: A URL API

2010-09-21 Thread Ojan Vafai
How about setParameter(name, value...) that takes var_args number of values? Alternately, it could take either a DOMString or an ArrayDOMString for the value. I prefer the var_args. Also, getParameterByName and getAllParametersByName seem unnecessarily wordy. How about

Re: A URL API

2010-09-21 Thread Devdatta Akhawe
On 21 September 2010 00:47, Ojan Vafai o...@chromium.org wrote: How about setParameter(name, value...) that takes var_args number of values? Alternately, it could take either a DOMString or an ArrayDOMString for the value. I prefer the var_args. What happens when I do

Re: A URL API

2010-09-21 Thread Adam Barth
On Tue, Sep 21, 2010 at 12:51 AM, Devdatta Akhawe dev.akh...@gmail.com wrote: On 21 September 2010 00:47, Ojan Vafai o...@chromium.org wrote: How about setParameter(name, value...) that takes var_args number of values? Alternately, it could take either a DOMString or an ArrayDOMString for the

Re: A URL API

2010-09-21 Thread Garrett Smith
On 9/21/10, Ojan Vafai o...@chromium.org wrote: How about setParameter(name, value...) that takes var_args number of values? Alternately, it could take either a DOMString or an ArrayDOMString for the value. I prefer the var_args. Why? A user-defined fallback will be necessary for a while.

Re: A URL API

2010-09-21 Thread Mihai Parparita
On Mon, Sep 20, 2010 at 11:02 AM, Garrett Smith dhtmlkitc...@gmail.com wrote: IOW, what are the cases where an XHR instance wants to use a lot o query params? I'm sure there are other examples, and it depends by what you mean by a lot, but here are all the parameters that Google Reader sends

Re: A URL API

2010-09-21 Thread Doug Schepers
Hi, Adam- I really like this idea. Of course there are scripts out there that do most (all?) of this, but exposing it as an interface seems useful to me. I proposed something similar in my SVG Params spec [1][2][3], though yours is better thought out. One difference is that I was

Re: A URL API

2010-09-21 Thread Devdatta Akhawe
Perhaps appendParameter(x, a, b, c) ? where appendParameter is the second API - separate from setParameter? so appendParmeter(x',a,b,c); setParameter(x,a) would result in ?x=a and without the second function call it would be ?x=ax=bx=c I am fine with this. cheers devdatta Adam

Re: A URL API

2010-09-21 Thread Tab Atkins Jr.
On Mon, Sep 20, 2010 at 11:56 PM, Adam Barth w...@adambarth.com wrote: Ok.  I'm sold on having an API for constructing query parameters. Thoughts on what it should look like?  Here's what jQuery does: http://api.jquery.com/jQuery.get/ Essentially, you supply a JSON object containing the

Re: A URL API

2010-09-21 Thread Ojan Vafai
appendParameter/clearParameter seems fine to me. On Wed, Sep 22, 2010 at 2:53 AM, Tab Atkins Jr. jackalm...@gmail.comwrote: On Mon, Sep 20, 2010 at 11:56 PM, Adam Barth w...@adambarth.com wrote: Ok. I'm sold on having an API for constructing query parameters. Thoughts on what it should

Re: A URL API

2010-09-20 Thread Adam Barth
On Sun, Sep 19, 2010 at 10:56 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 9/20/10 1:51 AM, Adam Barth wrote: 1)  The reference chain for actually parsing a URI terminates in HTML5 referencing the IRI RFC, which doesn't seem to define a parsing algorithm.  Did I just miss it? I'm working

Re: A URL API

2010-09-20 Thread Julian Reschke
On 20.09.2010 07:51, Adam Barth wrote: ... 2) Why lastPathComponent as opposed to, say, fileName? Renamed to fileName. ... -1 Please stay consistent with the terminology in the URI spec. Best regards, Julian

Re: A URL API

2010-09-20 Thread Ojan Vafai
On Mon, Sep 20, 2010 at 4:27 PM, Adam Barth w...@adambarth.com wrote: On Sun, Sep 19, 2010 at 10:48 PM, Devdatta Akhawe dev.akh...@gmail.com wrote: 1) There are now two methods for getting at the URL parameters. The and none for setting them? That's correct. Looking at various

Re: A URL API

2010-09-20 Thread Julian Reschke
On 20.09.2010 08:27, Adam Barth wrote: On Sun, Sep 19, 2010 at 10:48 PM, Devdatta Akhawedev.akh...@gmail.com wrote: 1) There are now two methods for getting at the URL parameters. The and none for setting them? That's correct. Looking at various libraries, there seems to be much more

Re: A URL API

2010-09-20 Thread Julian Reschke
On 20.09.2010 09:22, Garrett Smith wrote: ... I see setParameterValues there. Useful to build URLs for XHR. But OTOH -- Ajax that is using a lot of parameters, might be better using a form. Usually Ajax requests are simple requests -- not a large form submission. Sorry just have to be devils

Re: A URL API

2010-09-20 Thread Julian Reschke
On 20.09.2010 10:01, Adam Barth wrote: On Mon, Sep 20, 2010 at 12:34 AM, Julian Reschkejulian.resc...@gmx.de wrote: On 20.09.2010 09:22, Garrett Smith wrote: ... I see setParameterValues there. Useful to build URLs for XHR. But OTOH -- Ajax that is using a lot of parameters, might be better

Re: A URL API

2010-09-20 Thread Anne van Kesteren
On Mon, 20 Sep 2010 10:01:01 +0200, Adam Barth w...@adambarth.com wrote: Using the method attribute of the form element. It will not get you further than GET/POST; and PUT/DELETE with same-origin limitation. It also does not allow for custom headers, custom entity body, etc. -- Anne van

Re: A URL API

2010-09-20 Thread Garrett Smith
On 9/20/10, Julian Reschke julian.resc...@gmx.de wrote: On 20.09.2010 09:22, Garrett Smith wrote: ... I see setParameterValues there. Useful to build URLs for XHR. But OTOH -- Ajax that is using a lot of parameters, might be better using a form. Usually Ajax requests are simple requests --

Re: A URL API

2010-09-20 Thread Julian Reschke
On 20.09.2010 18:56, Garrett Smith wrote: No idea; I wouldn't expect it to work, even if some browser actually supported something other than GET|POST. I've always used get or post and that's what's stated in HTML4. http://www.w3.org/TR/html401/interact/forms.html#adef-method Might a large-ish

Re: A URL API

2010-09-19 Thread João Eiras
That would be different behavior than what Location and HTMLAnchorElement do; they unescape various componenents. Is the benefit worth the divergence? As a side note, an out-of-document HTMLAnchorElement already provides most of the functionality of this interface. Things it can't do: -

Re: A URL API

2010-09-19 Thread Devdatta Akhawe
hi Is the word 'hash' for fragment identifiers common? I personally prefer the attribute being called 'fragment' or 'fragmentID' over 'hash' - its the standard afaik in all the RFCs. regards devdatta On 19 September 2010 15:47, João Eiras joao.ei...@gmail.com wrote: That would be different

Re: A URL API

2010-09-19 Thread Tab Atkins Jr.
On Sun, Sep 19, 2010 at 5:03 PM, Devdatta Akhawe dev.akh...@gmail.com wrote: hi Is the word 'hash' for fragment identifiers common? I personally prefer the attribute being called 'fragment' or 'fragmentID' over 'hash' - its the standard afaik in all the RFCs. 'hash' is the name given to the

Re: A URL API

2010-09-19 Thread Adam Barth
On Fri, Sep 17, 2010 at 5:48 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Fri, Sep 17, 2010 at 5:43 PM, Adam Barth w...@adambarth.com wrote: I've removed the searchParameters attribute from the URL interface for the time being.  We can consider adding it back at a later time. ;_; Just

Re: A URL API

2010-09-19 Thread Boris Zbarsky
On 9/20/10 1:02 AM, Adam Barth wrote: I've updated the document: https://docs.google.com/document/edit?id=1r_VTFKApVOaNIkocrg0z-t7lZgzisTuGTXkdzAk4gLUhl=en# General comments based on a quick read (and ignoring various typos that I figure we'll fix in due course): 1) The reference chain

Re: A URL API

2010-09-19 Thread Devdatta Akhawe
1) There are now two methods for getting at the URL parameters.  The and none for setting them? cheers devdatta 2) The origin attribute is now readonly.  Once I wired up the origin attribute to the actual definition of how to compute the origin of a URL, it became obvious that we don't

Re: A URL API

2010-09-19 Thread Darin Fisher
On Sun, Sep 19, 2010 at 10:41 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 9/20/10 1:02 AM, Adam Barth wrote: I've updated the document: https://docs.google.com/document/edit?id=1r_VTFKApVOaNIkocrg0z-t7lZgzisTuGTXkdzAk4gLUhl=en# General comments based on a quick read (and ignoring

Re: A URL API

2010-09-18 Thread Adam Barth
On Fri, Sep 17, 2010 at 9:52 PM, Maciej Stachowiak m...@apple.com wrote: On Sep 17, 2010, at 1:01 PM, Adam Barth wrote: Another piece of functionality that's missing from HTMLAnchorElement is the automatic stringification of URL objects.  That lets you pass URL objects into APIs that expect

A URL API

2010-09-17 Thread Adam Barth
On Fri, Sep 17, 2010 at 10:27 AM, Adam Barth w...@adambarth.com wrote: On Thu, Sep 16, 2010 at 3:25 PM, Darin Fisher da...@chromium.org wrote: On Thu, Sep 16, 2010 at 6:31 AM, Julian Reschke julian.resc...@gmx.de wrote: That sounds good to me. In general I think it would be great if there were

Re: A URL API

2010-09-17 Thread Nathan
Adam Barth wrote: On Fri, Sep 17, 2010 at 10:27 AM, Adam Barth w...@adambarth.com wrote: On Thu, Sep 16, 2010 at 3:25 PM, Darin Fisher da...@chromium.org wrote: On Thu, Sep 16, 2010 at 6:31 AM, Julian Reschke julian.resc...@gmx.de wrote: That sounds good to me. In general I think it would be

Re: A URL API

2010-09-17 Thread Darin Fisher
On Fri, Sep 17, 2010 at 11:05 AM, Adam Barth w...@adambarth.com wrote: On Fri, Sep 17, 2010 at 10:27 AM, Adam Barth w...@adambarth.com wrote: On Thu, Sep 16, 2010 at 3:25 PM, Darin Fisher da...@chromium.org wrote: On Thu, Sep 16, 2010 at 6:31 AM, Julian Reschke julian.resc...@gmx.de

Re: A URL API

2010-09-17 Thread Adam Barth
On Fri, Sep 17, 2010 at 11:16 AM, Darin Fisher da...@chromium.org wrote: On Fri, Sep 17, 2010 at 11:05 AM, Adam Barth w...@adambarth.com wrote: On Fri, Sep 17, 2010 at 10:27 AM, Adam Barth w...@adambarth.com wrote: On Thu, Sep 16, 2010 at 3:25 PM, Darin Fisher da...@chromium.org wrote: On

Re: A URL API

2010-09-17 Thread Anne van Kesteren
On Fri, 17 Sep 2010 20:51:27 +0200, Maciej Stachowiak m...@apple.com wrote: That would be different behavior than what Location and HTMLAnchorElement do; they unescape various componenents. Is the benefit worth the divergence? As a side note, an out-of-document HTMLAnchorElement already

Re: A URL API

2010-09-17 Thread Adam Barth
On Fri, Sep 17, 2010 at 11:51 AM, Maciej Stachowiak m...@apple.com wrote: On Sep 17, 2010, at 11:36 AM, Adam Barth wrote: On Fri, Sep 17, 2010 at 11:16 AM, Darin Fisher da...@chromium.org wrote: On Fri, Sep 17, 2010 at 11:05 AM, Adam Barth w...@adambarth.com wrote: Here's a sketch:

Re: A URL API

2010-09-17 Thread Garrett Smith
On 9/17/10, Adam Barth w...@adambarth.com wrote: On Fri, Sep 17, 2010 at 11:51 AM, Maciej Stachowiak m...@apple.com wrote: On Sep 17, 2010, at 11:36 AM, Adam Barth wrote: On Fri, Sep 17, 2010 at 11:16 AM, Darin Fisher da...@chromium.org wrote: On Fri, Sep 17, 2010 at 11:05 AM, Adam Barth

Re: A URL API

2010-09-17 Thread Adam Barth
On Fri, Sep 17, 2010 at 2:39 PM, Garrett Smith dhtmlkitc...@gmail.com wrote: On 9/17/10, Adam Barth w...@adambarth.com wrote: On Fri, Sep 17, 2010 at 11:57 AM, Garrett Smith dhtmlkitc...@gmail.com wrote: Where is Dictionary defined? It might not be defined yet. You don't know if it is

Re: A URL API

2010-09-17 Thread Adam Barth
I've removed the searchParameters attribute from the URL interface for the time being. We can consider adding it back at a later time. Adam On Fri, Sep 17, 2010 at 5:21 PM, Garrett Smith dhtmlkitc...@gmail.com wrote: On 9/17/10, Adam Barth w...@adambarth.com wrote: On Fri, Sep 17, 2010 at

Re: A URL API

2010-09-17 Thread Tab Atkins Jr.
On Fri, Sep 17, 2010 at 5:43 PM, Adam Barth w...@adambarth.com wrote: I've removed the searchParameters attribute from the URL interface for the time being.  We can consider adding it back at a later time. ;_; Just today my cubemate asked me if there was any way to get at the search parameters

Re: A URL API

2010-09-17 Thread Nathan
Tab Atkins Jr. wrote: On Fri, Sep 17, 2010 at 5:43 PM, Adam Barth w...@adambarth.com wrote: I've removed the searchParameters attribute from the URL interface for the time being. We can consider adding it back at a later time. ;_; Just today my cubemate asked me if there was any way to get

Re: A URL API

2010-09-17 Thread Garrett Smith
On 9/17/10, Tab Atkins Jr. jackalm...@gmail.com wrote: On Fri, Sep 17, 2010 at 5:43 PM, Adam Barth w...@adambarth.com wrote: I've removed the searchParameters attribute from the URL interface for the time being. We can consider adding it back at a later time. ;_; Just today my cubemate

Re: A URL API

2010-09-17 Thread Devdatta Akhawe
hi You mean you didn't mention that I drafted a much better one over two years ago? Garrett : could you send a link to your ES4 draft/proposal ? My simple google skills couldn't find it. thanks devdatta And you felt this API was worth mentioning? My criticism is spot-on and appropriate.

Re: A URL API

2010-09-17 Thread Maciej Stachowiak
On Sep 17, 2010, at 1:01 PM, Adam Barth wrote: On Fri, Sep 17, 2010 at 11:51 AM, Maciej Stachowiak m...@apple.com wrote: It might be nice to provide the parts of this that make sense on HTMLAnchorElement and Location, then see if a new interface really pulls its weight. Another piece

Re: A URL API

2010-09-17 Thread Garrett Smith
On 9/17/10, Devdatta Akhawe dev.akh...@gmail.com wrote: hi You mean you didn't mention that I drafted a much better one over two years ago? Garrett : could you send a link to your ES4 draft/proposal ? My simple google skills couldn't find it. I thought I linked to that earlier but don't