W3C home > Mailing lists > Public > public-html@w3.org > September 2007

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>
To: "public-html@w3.org" <public-html@w3.org>

Consider the following HTML document:

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

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

   FORM
    INPUT type=hidden
    TABLE
     TBODY
      TR
       TD
        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 
<https://bugzilla.mozilla.org/show_bug.cgi?id=390565>.

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.  :(

Thoughts?

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

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:49 UTC