<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>7978</bug_id>
          
          <creation_ts>2009-10-20 11:58:38 +0000</creation_ts>
          <short_desc>Form foster parenting introduces extra space to layout</short_desc>
          <delta_ts>2010-10-04 13:57:03 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>pre-LC1 HTML5 spec (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>https://bugzilla.mozilla.org/show_bug.cgi?id=510063</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>NE</keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Henri Sivonen">hsivonen</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>28580</commentid>
    <comment_count>0</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2009-10-20 11:58:38 +0000</bug_when>
    <thetext>See https://bugzilla.mozilla.org/show_bug.cgi?id=510063

The issue needs a spec-level solution.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28681</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2009-10-21 08:00:25 +0000</bug_when>
    <thetext>&quot;Inserting a form on a page would often break the pixel-perfect design by pushing things around. That was caused by the forms margins, but I didnt know that. So to prevent this I used to insert the forms start and end tags between table rows.&quot; - http://www.456bereastreet.com/archive/200511/reveal_your_old_school_web_development_hacks/

I think we should just change the parser to not foster parent forms, to match old Gecko and WebKit (and not break oldschool pixel-perfect designs with 1em gaps whitespace here and there).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28755</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-10-21 11:39:03 +0000</bug_when>
    <thetext>What exactly would this consist of? Does it affect the foster parenting that goes on in the AAA also?

How do we deal with kids, like &quot;&lt;table&gt;&lt;form&gt;x&quot;? What about &quot;&lt;table&gt;&lt;form&gt;&lt;input type=hidden&gt;&quot;?

Why would these forms inside tables not affecting the rendering even more than forms outside tables?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28762</commentid>
    <comment_count>3</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2009-10-21 12:03:11 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Why would these forms inside tables not affecting the rendering even more than
&gt; forms outside tables?

They need to be made display: none; in the rendering section.
http://mxr.mozilla.org/mozilla-central/source/layout/style/html.css#273</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28772</commentid>
    <comment_count>4</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2009-10-21 12:16:58 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; They need to be made display: none; in the rendering section.
&gt; http://mxr.mozilla.org/mozilla-central/source/layout/style/html.css#273

:-moz-is-html means &quot;the HTMLness bit of the owner document of this node is true&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28833</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-10-23 05:11:50 +0000</bug_when>
    <thetext>Why check for the HTML bit? Seems like the same could be applied in XHTML.

EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter&apos;s comments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28834</commentid>
    <comment_count>6</comment_count>
    <who name="">contributor</who>
    <bug_when>2009-10-23 05:12:46 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r4288.
Check-in comment: Change for &lt;form&gt; is parsed in &lt;table&gt;.
http://html5.org/tools/web-apps-tracker?from=4287&amp;to=4288
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29018</commentid>
    <comment_count>7</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2009-10-26 12:27:58 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; Why check for the HTML bit? Seems like the same could be applied in XHTML.

CCing Boris, because I recall discussing this with him but I forgot what the reason for applying the style in HTML documents only was.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29020</commentid>
    <comment_count>8</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2009-10-26 13:16:10 +0000</bug_when>
    <thetext>Because if you apply that in XHTML, then the following perfectly reasonable (from a parsing point of view; it&apos;s clearly invalid) XHTML document won&apos;t work right:

&lt;body&gt;
  &lt;table&gt;
    &lt;form&gt;
      &lt;tr&gt;&lt;td&gt;Some text&lt;/td&gt;&lt;/tr&gt;
    &lt;/form&gt;
  &lt;/table&gt;
&lt;/body&gt;

This is a common pattern in HTML authoring, in fact; the display:none is OK in HTML because in this case the &lt;form&gt; ends up empty when parsed as HTML.
      </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29025</commentid>
    <comment_count>9</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2009-10-26 14:13:27 +0000</bug_when>
    <thetext>So I&apos;m trying to understand the change linked to in comment 6.  What behavior does it give for the following document:

  &lt;body&gt;
    &lt;table&gt;
      &lt;form&gt;&lt;tr&gt;&lt;td&gt;&lt;input name=&quot;one&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/form&gt;
      &lt;form&gt;&lt;tr&gt;&lt;td&gt;&lt;input name=&quot;two&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/form&gt;
    &lt;/table&gt;
    &lt;input name=&quot;three&quot;&gt;
    &lt;form&gt;&lt;input name=&quot;four&quot;&gt;&lt;/form&gt;
    &lt;input name=&quot;five&quot;&gt;
  &lt;/body&gt;

?  What does the DOM look like?  Which input is associated with which form?  How does that compare to what UAs do currently?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29030</commentid>
    <comment_count>10</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2009-10-26 14:40:40 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; Because if you apply that in XHTML, then the following perfectly reasonable
&gt; (from a parsing point of view; it&apos;s clearly invalid) XHTML document won&apos;t work
&gt; right:
&gt; 
&gt; &lt;body&gt;
&gt;   &lt;table&gt;
&gt;     &lt;form&gt;
&gt;       &lt;tr&gt;&lt;td&gt;Some text&lt;/td&gt;&lt;/tr&gt;
&gt;     &lt;/form&gt;
&gt;   &lt;/table&gt;
&gt; &lt;/body&gt;

You could end up with this tree in HTML too with scripting. Does it matter? Could we use :empty instead of :htmlness if it matters, or is that more expensive?


&gt; This is a common pattern in HTML authoring, in fact; the display:none is OK in
&gt; HTML because in this case the &lt;form&gt; ends up empty when parsed as HTML.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29031</commentid>
    <comment_count>11</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2009-10-26 14:52:29 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; So I&apos;m trying to understand the change linked to in comment 6.  What behavior
&gt; does it give for the following document:
&gt; 
&gt;   &lt;body&gt;
&gt;     &lt;table&gt;
&gt;       &lt;form&gt;&lt;tr&gt;&lt;td&gt;&lt;input name=&quot;one&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/form&gt;
&gt;       &lt;form&gt;&lt;tr&gt;&lt;td&gt;&lt;input name=&quot;two&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/form&gt;
&gt;     &lt;/table&gt;
&gt;     &lt;input name=&quot;three&quot;&gt;
&gt;     &lt;form&gt;&lt;input name=&quot;four&quot;&gt;&lt;/form&gt;
&gt;     &lt;input name=&quot;five&quot;&gt;
&gt;   &lt;/body&gt;
&gt; 
&gt; ?  What does the DOM look like?

Like this XML:

  &lt;body&gt;
     &lt;table&gt;
       &lt;form/&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;input name=&quot;one&quot;/&gt;&lt;/td&gt;&lt;/tr&gt;
       &lt;form/&gt;&lt;tr&gt;&lt;td&gt;&lt;input name=&quot;two&quot;/&gt;&lt;/td&gt;&lt;/tr&gt;
     &lt;/tbody&gt;&lt;/table&gt;
     &lt;input name=&quot;three&quot;/&gt;
     &lt;form&gt;&lt;input name=&quot;four&quot;/&gt;&lt;/form&gt;
     &lt;input name=&quot;five&quot;/&gt;
   &lt;/body&gt;


&gt; Which input is associated with which form?

Same as before. &quot;three&quot; and &quot;five&quot; aren&apos;t associated with any form; &quot;one&quot;, &quot;two&quot; and &quot;four&quot; are associated with the form you&apos;d expect.

&gt; How does that compare to what UAs do currently?

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/292

In this case it seems to match old Gecko, WebKit and Opera (even though Opera has a different strategy for dealing with forms in tables currently). The association should match IE, too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29032</commentid>
    <comment_count>12</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2009-10-26 15:11:33 +0000</bug_when>
    <thetext>&gt; You could end up with this tree in HTML too with scripting. Does it matter?

Apparently not, since Mozilla has gotten no bug reports on it, unlike the other approaches we&apos;ve tried here.

&gt; Could we use :empty instead of :htmlness if it matters, or is that more
&gt; expensive?

:empty is certainly more expensive; I can&apos;t say how much more offhand.  In some cases it&apos;s probably not noticeable at all.  On the other hand, I can certainly construct pathological testcases which cause :empty to trigger O(N) behavior on append in Gecko.  I can&apos;t speak to other engines.

Comment 11 sounds good.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29033</commentid>
    <comment_count>13</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2009-10-26 15:13:32 +0000</bug_when>
    <thetext>I should note that the fact that :empty could trigger said O(N) behavior in cases when the form is not in fact a child of a table/tr is considered a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=501848</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29034</commentid>
    <comment_count>14</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2009-10-26 15:24:56 +0000</bug_when>
    <thetext>(In reply to comment #12)
&gt; &gt; You could end up with this tree in HTML too with scripting. Does it matter?
&gt; 
&gt; Apparently not, since Mozilla has gotten no bug reports on it, unlike the other
&gt; approaches we&apos;ve tried here.

Ok. But does the invalid XHTML case matter?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29036</commentid>
    <comment_count>15</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2009-10-26 15:36:34 +0000</bug_when>
    <thetext>It seems like the behavior for that case is well-specified by the XML (for the parsing) and CSS (for the layout) specifications.  If the HTML specification requires a UA stylesheet that modifies that behavior, then we could probably get away with making that form display:none; absent that, doing so would be a bug, pure and simple.

Are we ok with documents either showing the form elements or not depending on whether they&apos;re served as HTML or XHTML?  I realize there will be other layout differences between the two in this case, but this is a slightly different order of breakage.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29037</commentid>
    <comment_count>16</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2009-10-26 15:53:28 +0000</bug_when>
    <thetext>FWIW, it makes more sense to me if HTML and XHTML have the same style sheet applied to them. I doubt we&apos;d break existing invalid XHTML by doing this, but I guess we&apos;ll notice when someone ships with this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29038</commentid>
    <comment_count>17</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2009-10-26 15:57:45 +0000</bug_when>
    <thetext>What&apos;s the context for the stylesheet change in that diff?  Is that a required stylesheet (MUST), or a recommended one (SHOULD)?

Note that I&apos;m somewhat averse to in-the-wild experimentation on this topic (aka the &quot;ship and see what breaks and what bad press you get&quot; approach), since it seems that there are solutions not requiring that.  In general, that feels like it ought to be a last resort unless there is hard data that there should be minimal compat issues (e.g. at least one major UA already ships the behavior).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29042</commentid>
    <comment_count>18</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2009-10-26 19:05:05 +0000</bug_when>
    <thetext>(In reply to comment #17)
&gt; What&apos;s the context for the stylesheet change in that diff?  Is that a required
&gt; stylesheet (MUST), or a recommended one (SHOULD)?

The rendering section is non-normative, so neither. However, I think the goal is for visual interactive desktop browsers to follow it exactly...

http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#rendering</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29043</commentid>
    <comment_count>19</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2009-10-26 19:25:37 +0000</bug_when>
    <thetext>The point is, if someone shows up and says &quot;this breaks my site&quot;, then we need to either point to the part of the HTML spec that requires us to have this bizarre behavior in XHTML or admit that the breakage is a browser bug, no?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29044</commentid>
    <comment_count>20</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2009-10-26 19:36:54 +0000</bug_when>
    <thetext>You could point out that they&apos;re using invalid XHTML, and that HTML5&apos;s rendering section says to do this, and that doing this is a slight performance win (or maybe it isn&apos;t?).

I could say that Opera would be ready to do this, but we&apos;d need to switch to the HTML5 way or parsing and so first so it&apos;d be some time yet until we could actually usefully do it.

I wouldn&apos;t object to making HTML5 say to have different behavior for HTML and XHTML in this case for now and revisit this when Opera is ready to do the experiment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29048</commentid>
    <comment_count>21</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-10-27 00:44:38 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; Because if you apply that in XHTML, then the following perfectly reasonable
&gt; (from a parsing point of view; it&apos;s clearly invalid) XHTML document won&apos;t work
&gt; right:
&gt; 
&gt; &lt;body&gt;
&gt;   &lt;table&gt;
&gt;     &lt;form&gt;
&gt;       &lt;tr&gt;&lt;td&gt;Some text&lt;/td&gt;&lt;/tr&gt;
&gt;     &lt;/form&gt;
&gt;   &lt;/table&gt;
&gt; &lt;/body&gt;

This wouldn&apos;t work right anyway. You&apos;d end up with two nested CSS tables. So I don&apos;t really see that it matters if we make this display:none or display:block.

The spec change doesn&apos;t require the &apos;display:none&apos; on table&gt;form to be !important,  unlike the Gecko implementation. Is that a problem?

I don&apos;t mind changing any of this, but I&apos;d really like to avoid quirks or XHTML mode differences if at all possible. Please reopen the bug if there&apos;s something to change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29049</commentid>
    <comment_count>22</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-10-27 00:46:15 +0000</bug_when>
    <thetext>Based on https://bugzilla.mozilla.org/show_bug.cgi?id=349695 I assume that this needs to be hard-coded for HTML (without the ability for author-CSS to override); if this is the case, it probably makes sense to make it HTML only. If anyone concurs that this should indeed change, please reopen the bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29050</commentid>
    <comment_count>23</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2009-10-27 01:38:11 +0000</bug_when>
    <thetext>&gt; You&apos;d end up with two nested CSS tables.

Sure.  Note that sites do that a good bit by setting &quot;display: block&quot; on their table rows right now, by the way.

&gt; So I don&apos;t really see that it matters if we make this display:none or
&gt; display:block.

You don&apos;t think it matters whether the user can see the inputs?

&gt; Is that a problem?

As you note in comment 22, yes.

&gt; if this is the case, it probably makes sense to make it HTML only.

Right.

&gt; If anyone concurs that this should indeed change, please reopen the bug.

I would love to do that, but do not have editbugs bits in this bugzilla, and therefore cannot do so.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29051</commentid>
    <comment_count>24</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-10-27 02:00:57 +0000</bug_when>
    <thetext>zcorpan/mike, can you hook bz up with perms?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29053</commentid>
    <comment_count>25</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-10-27 10:01:43 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporters&apos; comments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29054</commentid>
    <comment_count>26</comment_count>
    <who name="">contributor</who>
    <bug_when>2009-10-27 10:02:35 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r4347.
Check-in comment: Rephrase how &lt;form&gt; in &lt;table&gt; is to be hidden for compatibility.
http://html5.org/tools/web-apps-tracker?from=4346&amp;to=4347
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29162</commentid>
    <comment_count>27</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2009-10-28 07:44:00 +0000</bug_when>
    <thetext>Thanks.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>