W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2011

[whatwg] Search-suggestions without scripting

From: Alexandre Morgaut <Alexandre.Morgaut@4d.com>
Date: Thu, 18 Aug 2011 08:50:39 +0200
Message-ID: <7D518630-618D-4719-8F34-51DE6FCD7F9C@4d.com>

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

60, rue d'Alsace
92110 Clichy

Standard : +33 1 40 87 92 00
Email :    Alexandre.Morgaut at 4d.com
Web :      www.4D.com
Received on Wednesday, 17 August 2011 23:50:39 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:35 UTC