

Question about mis-nested form controls and parsing

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sun, 02 Sep 2007 22:08:50 -0500
Message-ID: <46DB7AC2.9090703@mit.edu>

Consider the following HTML document:

<form method="GET">
     <tr><td><input type="text" name="one" value="one"></td></tr>
     <input type="hidden" name="two" value="two">

When parsed using the algorithm in HTML5 section, the DOM this creates is:

    INPUT type=hidden
        INPUT type=text

and then http://www.whatwg.org/specs/web-forms/current-work/#elements says that 
the hidden input comes first in form.elements and 
http://www.whatwg.org/specs/web-forms/current-work/#form-submission says that 
the submitted query string needs to be "one=one&two=two".

Unfortunately, doing that breaks sites, as we (Mozilla) discovered when we 
actually started doing the document order thing.  See 

What we are considering doing right now is allowing <input type="hidden"> (but 
not other kinds of inputs) to be direct children of TABLE, TBODY, and TR.  That 
seems to address at least the site in question.  Hopefully, the number of sites 
that put non-hidden inputs in a place where they get shipped out from the table 
_and_ depend on submission order being the same as source order is small.... But 
then again, I'd banked that the number of sites which do the malformed content 
above and depend on submission order is small too, and we found one pretty 
quickly.  :(


Received on Monday, 3 September 2007 03:09:02 UTC
