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

Re: Question about mis-nested form controls and parsing

From: Ben Boyle <benjamins.boyle@gmail.com>
Date: Tue, 4 Sep 2007 01:15:10 +1000
Message-ID: <5f37426b0709030815h6b452b83l85082d841ad09c7f@mail.gmail.com>
To: "Boris Zbarsky" <bzbarsky@mit.edu>
Cc: "public-html@w3.org" <public-html@w3.org>

If you put content model rules aside for a moment, a parse tree that
matches the source order is most likely to reflect the author's intent
(I'm assuming a "general" author here as opposed to an author who is
trying to make use of browser hacks).

Appending the input as a child of tr would match this. So I would
support this behaviour (though I would not consider it "conforming"
and would want validation tools to highlight it as a code issue).

You could probably achieve the same by appending the input as a child
of the td (the last element parsed in linear source order that was
allowed to contain an input element). That would preserve the order of
the form elements whilst conforming to current content models. There
are probably similar scenarios where other missing elements make this
approach impossible.

I can't speak for the difficulties in implementing either approach.

At the end of the day, as an author who tries to "conform" with the
specifications, it doesn't matter a great deal to me how this error is

I can't back it up but I think a lot of websites depend on submission
order. I would be checking for how frameworks handle multiple inputs
with the same name (e.g. foo=1bar&foo=2bar). Though there are two
values, many frameworks will assign precedence to the first or last
value (if you ask for a single value and not all values). That could
be influenced by this proposal.

Hope that's a little help.


On 9/3/07, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> 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, 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 15:15:15 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:26 UTC