[whatwg] input element list attribute and filtering suggestions

Ian Hickson ian at hixie.ch
Mon May 2 15:32:44 PDT 2011

On Fri, 31 Dec 2010, Jonas Sicking wrote:
> >
> > The thing that makes this different than "Google suggest"-style UI is 
> > that in the latter case you need a script that continually polls for 
> > more appropriate suggestions and updates the list -- for this kind of 
> > thing we'd probably want to use a direct API, we wouldn't want to have 
> > scripts have to poke at the <datalist> DOM in real time.
> Why not?
> The firefox implementation should allow this (though I haven't tried 
> this myself). Feel free to try it out and let us know how well/poorly it 
> works.

I just meant that it would be a poor authoring experience. I agree that it 
should in theory be possible with the current API; it just seems that if 
that's the use case we want to address, we should instead just have 
people point to a URL and be done with it:

   <input type=text autosuggest="/cgi-bin/autocomplete.pl">

...or some such.

On Fri, 31 Dec 2010, Jonas Sicking wrote:
> I like the idea of bolding the matching parts of the suggestions which 
> match the typed string. Or at least creating a pseudo-element which 
> selected the matching substrings such that you could get the behavior 
> you want using:
> input::matching-suggest {
>   font-weight: bold;
> }

Interesting idea (probably more a CSS thing that HTML though, depends on 
how we end up specifying widget-specific pseudo-elements).

> That aside, I do in general agree that it would be nice to allow markup 
> inside <option>s. I do wonder if a lot of pages would break if parsing 
> was changed in such a way.

This has been suggested in the past. Old builds of Mozilla -- I mean, 
REALLY old builds of Mozilla, like back in the M3 days, before Mozilla 
0.6 -- allowed you to put <img> in <option>. We changed that at some 
point; I don't recall why but I could guess compat.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list