W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: URL spec parameter-related methods use "parameter" in a way inconsistent with the URI RFC

From: Charles McCathieNevile <chaals@opera.com>
Date: Thu, 24 May 2012 14:25:34 +0200
To: "public-webapps@w3.org WG" <public-webapps@w3.org>, "Maciej Stachowiak" <mjs@apple.com>
Message-ID: <op.wetbgwuiwxe0ny@widsith-3.local>
+1 (top post FTW)

cheers

On Thu, 24 May 2012 11:29:24 +0200, Maciej Stachowiak <mjs@apple.com>  
wrote:

> The current draft URL spec has a number of Parameter-related methods  
> (getParameterNames, getParameterValues, hasParameter, getParameter,  
> setParameter, addParameter, removeParameter, clearParameters)[1].  
> Apparently these methods refer to key-value pairs in the query part of  
> the URL as "parameters". However, the term "parameter" is used by the  
> URI RFC[2] to refer to something else, a semicolon-delimited part of a  
> path (which I think is nearly obsolete in modern use; I am not sure what  
> it is for). I understand that for legacy reasons, much of the URL  
> interface cannot be consistent with RFC-official terminology. But it  
> seems like a bad idea to use the same term for a different piece of the  
> URL, worse than using the same term for a different part. At least call  
> it something like "query parameters" to disambiguate.
>
> Another point of feedback on the parameter-related methods: they seem to  
> form a dictionary-style interface, and it seems inelegant to have all  
> these different methods giving a dictionary-style interface to something  
> that is a piece of the URL, rather than something that is the URL.
>
> One possible way to solve both these problems:
>
> interface URL {
>     StringMultiMap queryParameters;
> }
>
> interface StringMultiMap {
>      sequence<DOMString> keys;
>      sequence<DOMString> getAll(DOMString name)
>      boolean contains(DOMString name)
>      DOMString? get(DOMString name);
>      void set(DOMString name, DOMString value);
>      void add(DOMString name, DOMString value);
>      void remove(DOMString name);
>      void clear();
> }
>
> The StringMultiMap interface could be reusable for other, similar  
> key-value list contexts.
>
> Or else use an appropriate dictionary type from ES if one is ever  
> provided.
>
> Regards,
> Maciej
>
>
> [1]  
> http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#dom-url-getparameternames
> [2] http://www.ietf.org/rfc/rfc2396.txt


-- 
Charles 'chaals' McCathieNevile  Opera Software, Standards Group
     je parle français -- hablo español -- jeg kan noen norsk
http://my.opera.com/chaals       Try Opera: http://www.opera.com
Received on Thursday, 24 May 2012 12:26:18 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:52 GMT