[whatwg] Re: Suggestions: <select datalist> and the functionality of the |for| attribute.

Ian Hickson ian at hixie.ch
Fri Jul 9 06:44:08 PDT 2004

On Wed, 7 Jul 2004, Matthew Raymond wrote:
> Ian Hickson wrote:
>> I feel I missed something somewhere. What is wrong with <datalist>?
> It mixes the legacy markup and <option> elements

Right, why is that bad?

It's like how <map> mixes legacy markup and <a> elements.

> and in fact could even theoretically allow invalid legacy markup on WF2
> clients, since on such clients it ignores everything but <option>
> elements.

I don't understand what you mean by this.

> So I could do the following...
> <datalist id="myList">
>    <html>
>      <body></body>
>      <body></body>
>      <head>
>      <select>
>        <option>Item 1</option>
>      </select>
>      <select>
>        <option>Item 2</option>
>      </select>
>      <select>
>      </select>
>      <option>Item 3</option>
>      <option>Item 4</option>
>      <option>Item 5</option>
>      </head>
>    </html>
> </datalist>

This would be invalid, though.

I mean, you could always put any random tag in any random place, indeed a
large proportion of HTML authors seem to think this is perfectly normal.
There is nothing that I can see about <datalist> that introduces or
encourages this at all.

> ...And a WF2-compliant UA would treat the above the same as this:
> <datalist id="myList">
>    <option>Item 1</option>
>    <option>Item 2</option>
>    <option>Item 3</option>
>    <option>Item 4</option>
>    <option>Item 5</option>
> </datalist>
>     In other words, there is no separation of legacy code and list
> options. The same might be true with <select>, of course, but there it's
> not rendered because the markup isn't supposed to be there in the first
> place, not because it's defined as a way of handling legacy code.

What's the difference?

> Despite my distaste for how <datalist> handles legacy code, I must
> concede that it is the best solution presented on the mailing list, and
> I approve of its inclusion in the latest draft of Web Forms 2.0.

I agree it's not perfect, but yeah, I think it's the best one so far.

When the requirements are somewhat self-contradictory, it's hard to come
up with the ideal solution. :-)

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