This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10771 - User agents disagree with each other and with the spec on rendering of multiple legends if the first one is styled
Summary: User agents disagree with each other and with the spec on rendering of multip...
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on: 10546
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-27 17:23 UTC by Boris Zbarsky
Modified: 2010-10-14 08:49 UTC (History)
4 users (show)

See Also:


Attachments

Description Boris Zbarsky 2010-09-27 17:23:33 UTC
Consider this testcase:

  <fieldset>
    <legend style="position: absolute">aaa</legend>
    <legend>bbb</legend>
  </fieldset>
The text added in bug 10547 defines Presto's behavior on this testcase, I think.  Gecko and Webkit make the second legend into the legend rendered over the border of the fieldset in this case.

Note that it's not just a matter of Webkit/Gecko operating on the box tree while Presto operates on the DOM.  This testcase:

  <fieldset>
    <legend style="display: none">aaa</legend>
    <legend>bbb</legend>
  </fieldset>

is interoperably rendered in Presto/Gecko/Webkit with "bbb" as the legend, which doesn't match what bug 10547 specified.
Comment 1 Boris Zbarsky 2010-09-27 18:02:06 UTC
For what it's worth the Gecko behavior is that when constructing CSS boxes, if we're constructing a box for an HTML <legend> element whose parent in the DOM is an HTML <fieldset> element and if the parent box of the given box is a fieldset box (this part is needed to deal with XBL stuff) and if the <legend> element is in-flow then we create a special legend box for the element.  This box is more or less like a block in most respects.  Note that we can end up creating more than one legend box for a given fieldset (e.g. if you just have two unstyled legends).

Then once we have constructed all the child boxes for the fieldset, we scan the list of child boxes looking for the first legend box, if any.  If one is found, we use that a the legend for the fieldset, pulling it out of the normal in-flow child list.

And of course on dynamic mutations things have to update properly (e.g. removing the fieldset's legend has to pick up the next one; inserting legends needs to notice them, etc).
Comment 2 Boris Zbarsky 2010-09-27 18:04:01 UTC
Simple testcase of part of that last bit, which is passed by Gecko/Presto/Webkit (though Webkit paints wrong):

<fieldset>
  <legend id="x" style="display: none">This should now be the legend</legend>
  <legend onclick="document.getElementById('x').style.display = ''">Click me</legend>
</fieldset>
Comment 3 Ian 'Hixie' Hickson 2010-10-05 22:13:56 UTC
EDITOR'S RESPONSE: This is an Editor'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: Sorry about that. Let's try again. Please don't hesitate to reopen this bug if it's still wrong.
Comment 4 contributor 2010-10-05 22:14:43 UTC
Checked in as WHATWG revision r5583.
Check-in comment: Try to define how <legend> renders more accurately.
http://html5.org/tools/web-apps-tracker?from=5582&to=5583
Comment 5 Boris Zbarsky 2010-10-06 04:30:08 UTC
There's no mention of display:none anywhere in there.  Should there be?
Comment 6 Ian 'Hixie' Hickson 2010-10-12 08:28:01 UTC
Doesn't "out-of-flow" cover that case? I'm happy to add it explicitly if you think that would help.
Comment 7 Boris Zbarsky 2010-10-12 13:22:40 UTC
> Doesn't "out-of-flow" cover that case?

Not using the usual CSS definition (which applies to boxes, hence makes no sense at all for display:none).
Comment 8 Ian 'Hixie' Hickson 2010-10-14 08:39:52 UTC
EDITOR'S RESPONSE: This is an Editor'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: Man, my CSS spec-fu is so rusty.

Anyway, I've tried to fix this. Please don't hesitate to reopen the bug if I continue to prove incompetent. :-)
Comment 9 contributor 2010-10-14 08:49:43 UTC
Checked in as WHATWG revision r5626.
Check-in comment: compat rendering for <legend> with display:none
http://html5.org/tools/web-apps-tracker?from=5625&to=5626