[whatwg] Markup for Web Forms 2.0 that still requires discussion

Jim Ley wrote:
> None of these reasons are particular onerous, I hope there are other
> ones being used to reject this.

    Okay, let's look at this more closely. Here are two blocks of code, 
one using the <object>-based combo, the other using <datalist>:

<object name="combo" classid="urn:web-forms2-combobox-text">
   <param name="defaultValue" value="[default]" valuetype="data">
   <input type="text" name="combo" value="[default]">
   <label> or select from the list:</label>
   <select name="combo">
     <option>Item 1</option>
     <option>Item 2</option>
     <option>Item 3</option>
   </select>
</object>

<input type="text" name="combo" value="[default]" list="myList">
<datalist id="myList">
   <label> or select from the list:</label>
   <select name="combo">
     <option>Item 1</option>
     <option>Item 2</option>
     <option>Item 3</option>
   </select>
</datalist>

    Neither looks all that more complicated than the other, but let's 
remove all markup that is common to both blocks and see what we have:

<object name="combo" classid="urn:web-forms2-combobox-text">
   <param name="defaultValue" value="[default]" valuetype="data">
</object>

  list="myList"
<datalist id="myList">
</datalist>

    We see several striking things. First, the |name| attribute, the 
input type and the default value are repeated in the <object> example, 
but not in the <datalist> example. Also, the webmaster would have to 
memorize a |classid| for each <input> element input type.

    In addition, only <param> elements are used by the <object> in HTML 
4.01. The rest of the content of <object> is only rendered if the object 
fails to be created. Therefore, the use of the <option> elements by 
<object> that is dependent on the |classid| is a rather complicated 
extension. If we're going to create such complications, why not use a 
new element instead of corrupting <object>?

    Of course, you could use <param> to create list items, but that 
would require duplication of the data in all the <option> elements.

    Now let's look at non-legacy examples:

<object name="combo" classid="urn:web-forms2-combobox-text">
   <param name="defaultValue" value="[default]" valuetype="data">
   <option>Item 1</option>
   <option>Item 2</option>
   <option>Item 3</option>
</object>

<input type="text" name="combo" value="[default]" list="myList">
<datalist id="myList">
   <option>Item 1</option>
   <option>Item 2</option>
   <option>Item 3</option>
</datalist>

    You end up with exactly the same number of elements and attributes. 
The difference is that if you start with an <input> textbox and want to 
switch to a combo with the <object>-based model, you must replace the 
entire <input> element.

    There's also the issue of the webmaster knowing how to use <object 
declare>, but that's minor. The use of how complicated it is to reuse 
lists is a bit more valid:

<object declare id="combo" classid="urn:web-forms2-combobox-text">
   <option>Item 1</option>
   <option>Item 2</option>
   <option>Item 3</option>
</object>
<object name="combo1" classid="#combo">
   <param name="defaultValue" value="[default1]" valuetype="data">
</object>
<object name="combo2" classid="#combo">
   <param name="defaultValue" value="[default2]" valuetype="data">
</object>
<object name="combo3" classid="#combo">
   <param name="defaultValue" value="[default3]" valuetype="data">
</object>

<datalist id="myList">
   <option>Item 1</option>
   <option>Item 2</option>
   <option>Item 3</option>
</datalist>
<input type="text" name="combo1" value="[default1]" list="myList">
<input type="text" name="combo2" value="[default2]" list="myList">
<input type="text" name="combo3" value="[default3]" list="myList">

    Believe me, if I had found what I believed to be a better solution 
than <datalist>, I would be very solidly behind it.

Received on Monday, 12 July 2004 09:49:40 UTC