[Bug 22400] New: [Templates]: Form-associated elements inside templates should not be associated with forms by the parser

https://www.w3.org/Bugs/Public/show_bug.cgi?id=22400

            Bug ID: 22400
           Summary: [Templates]: Form-associated elements inside templates
                    should not be associated with forms by the parser
    Classification: Unclassified
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Component Model
          Assignee: rafaelw@chromium.org
          Reporter: adamk@chromium.org
        QA Contact: public-webapps-bugzilla@w3.org
                CC: dglazkov@chromium.org, hsivonen@iki.fi, ian@hixie.ch,
                    robin@w3.org, tross@microsoft.com, w3c@adambarth.com,
                    wchen@mozilla.com
            Blocks: 15476

For markup such as

(a) <form><template><input></template></form>

or

(b) <template><form><template><input></template></form></template>

the spec currently requires that the <input> be associated with the <form>. But
that is incorrect: in case (b), the form and input are in different trees. And
in case (a), they are not even in the same document! The existing
implementations in WebKit, Blink, and Gecko all make this "mistake".

To correct it, I propose that the paragraph in the section on "Creating and
inserting elements"
(http://www.w3.org/html/wg/drafts/html/master/syntax.html#creating-and-inserting-elements)
which currently reads:

"If an element created by the insert an HTML element algorithm is a
form-associated element, and the form element pointer is not null, and the
newly created element doesn't have a form attribute, the user agent must
associate the newly created element with the form element pointed to by the
form element pointer when the element is inserted, instead of running the reset
the form owner algorithm."

have an additional clause added, requiring that the element has an
ownerDocument with a browsing context. This will keep this special-casing of
form association from taking place inside templates. I've implemented this in
Blink in https://codereview.chromium.org/17033002/ (this misbehavior was
causing some crashes, which is why I'm landing the code before a spec update).

An alternate approach would have been to compare the <form>'s ownerDocument
with the <input>, but that would lead to the wrong answer in case (b) above
(since both <template>'s contents share the same browsing context-less
document).

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 18 June 2013 21:00:23 UTC