[whatwg] Search-suggestions without scripting

Alexandre Morgaut Alexandre.Morgaut at 4d.com
Wed Aug 17 23:50:39 PDT 2011


On 18 août 2011, at 00:15, Aryeh Gregor wrote:
> That's an interesting point.  There's no reason that autosuggest for
> browser URL bars and search inputs has to be any different.  Given
> that all the infrastructure here is already present, a new attribute
> like suggestions="http://path/to/opensearch" would be all that's
> needed.  It would be relatively easy for browsers to implement, and
> trivial for webpages to use if they're already using OpenSearch.  I
> don't think this has to be related to <datalist> -- just have a new
> attribute on <input>.


Just take care that:

- The main difference between the autosuggest in HTML forms and autosuggest in search bar is that for a search bar, the value associated to the label is always an url.
        -> for HTML forms, the result set should not be returned as a list of <link> element like in some OpenSearch result sets. Using <option> elements look more appropriate.

- Using a datalist element is helpful because several <input> elements can then refer to the same value list (like for "home city" and "office city")

 - We may need to add an asynchronous API to be also able to manipulate the list of options via JavaScript

But yes, without maybe the last point, it should be quite simple to implement.
Another point: the code managing autosuggestion in search bars is not running in a document context, and don't need currently to take care of Cross-Origin policy... Just a bit of more work to do ;-)




Alexandre Morgaut
Product Manager

4D SAS
60, rue d'Alsace
92110 Clichy
France

Standard : +33 1 40 87 92 00
Email :    Alexandre.Morgaut at 4d.com
Web :      www.4D.com





More information about the whatwg mailing list