[whatwg] Why children of datalist elements are barred from constraint validation?

Ian Hickson ian at hixie.ch
Thu Jul 28 18:07:03 PDT 2011


On Mon, 2 May 2011, Jonas Sicking wrote:
> On Mon, May 2, 2011 at 3:36 PM, Ian Hickson <ian at hixie.ch> wrote:
> >
> > <select> in a <datalist> is completely ignored for form submission. In 
> > fact, any form element at all in <datalist> is ignored for form 
> > submission. See the "construct the form data set" algorithm:
> >
> > http://www.whatwg.org/specs/web-apps/current-work/complete.html#constructing-the-form-data-set
> >
> > It's so that you can do things like:
> >
> >   <input ... list=options>
> >   <datalist id=options>
> >     <select ...>
> >       <option>...</option>
> >     </select>
> >     ...maybe other form controls here...
> >   </datalist>
> >
> > Basically everything in the <datalist> except the <option> elements is 
> > for fallback in legacy UAs and is ignored in new UAs.
> 
> Couldn't this be accomplished using a few lines of javascript?

Not when scripts are disabled, no.


> That seems like a better solution than one that for all eternity adds 
> browser code complexity both to do a deep search for <option> elements 
> when building the list for <datalist>, and that requires walking the 
> parent chain whenever submitting form controls.

It doesn't seem that bad. Surely code for both of those is so widely used 
in a browser that both of those operations are basically one-liners.

-- 
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