[whatwg] Allow <form> as a child of <tbody>

Ian Hickson ian at hixie.ch
Mon Oct 30 16:50:30 PST 2006


On Tue, 31 Oct 2006, Simon Pieters wrote:
> > >
> > > <table>
> > >  <form action="/edit" method="post">
> > >   <tr>
> > >    <td>
> > >     <input type="hidden" name="id" value="1"/>
> > >     <input type="text" name="name" value="First Row"/>
> > >
> > > This also happens to be backwards compatible with legacy UA's.
> > 
> > Check the DOM for that markup. "Backwards compatible" is not the words 
> > I would use...
> 
> FWIW, apparently I'm not the only one who thinks that having <form> as 
> child of <tbody> is intuitive.

Sure, it would be great. I've nothing against the idea in principle. I 
just don't see how to execute it.

For backwards compatibility reasons we can't change what DOM we get from 
misplaced <form> elements. Nor can we use what IE does, since IE doesn't 
actually generate a true DOM tree. Even if we could, it would mean also 
changing the CSS table model -- which ordinarily I would say is fine, but 
in this case the table model is one of the most complicated parts of CSS 
and changing it would be a huge amount of work.

As it is, we have a feature that address this use case and several others 
(the form="" attribute). As much as I'd love to be able to introduce 
random elements into the table DOM, it really seems that doing so would be 
far more pain that it is worth.


> If the main use-case for form="" is to allow forms for each TR then 
> allowing the above practise would make form="" redudant for that 
> use-case. Obviously form="" has other use-cases, but if implementors 
> don't want it yet it can perhaps wait to WF3... I don't have strong 
> opinions about form="", I only know that <form><tr> "works" in all 
> browsers while form="" only works in HTML5 browsers.

It only "works" in terms of the resulting form behaviour. If you actually 
constructed the same page using DOM calls, it wouldn't work (you'd either 
get the wrong rendering or the wrong form associations, depending which 
DOM you tried to create). What's currently happening is a giant hack, not 
something that IMHO we should condone.

Again, I'd love to do this. I just don't see _how_ to do it within the 
constraints of a sane DOM, without a huge amount of work both in updating 
specs (like CSS) and implementations that use those specs.

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