Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The definition of "rendered legend" should use the box tree, or at least the flat tree. #3331

Closed
emilio opened this issue Jan 6, 2018 · 9 comments · Fixed by #3934
Closed
Labels
interop Implementations are not interoperable with each other topic: fieldset topic: rendering

Comments

@emilio
Copy link
Contributor

emilio commented Jan 6, 2018

That is how browsers (at least WebKit / Gecko / Blink) implement it, and it makes sense.

If it's defined using the flat tree it should account for display: contents ancestors (skipping them as appropriate).

@emilio emilio changed the title The definition "rendered legend" should use the box tree, or at least the flat tree. The definition of "rendered legend" should use the box tree, or at least the flat tree. Jan 6, 2018
@annevk
Copy link
Member

annevk commented Jan 6, 2018

Can you give examples that demonstrate the difference in definition? (The current definition already pokes at the box tree afaict.)

@annevk annevk added the interop Implementations are not interoperable with each other label Jan 6, 2018
@emilio
Copy link
Contributor Author

emilio commented Jan 6, 2018

Trivial example would be:

<fieldset>
  <div style="display: contents">
    <legend>Legend</legend>
  </div>
</fieldset>

You could construct another with Shadow DOM adding a <slot> under a <fieldset> and slotting a <legend> inside.

https://html.spec.whatwg.org/#rendered-legend says:

If the fieldset element has a child that matches the conditions in the list below

Where child is the light tree child concept (https://dom.spec.whatwg.org/#concept-tree-child), which is the bit I expect to change with this issue.

@annevk
Copy link
Member

annevk commented Jan 6, 2018

I guess for legend this is reasonable as it cannot be otherwise observed, but we should be careful not to change all child-based lookup like this (e.g., when searching for option elements or some such).

@annevk
Copy link
Member

annevk commented Jan 6, 2018

Not entirely sure what terminology to use though as CSS doesn't really define the box model in sufficient detail. Would "first child box whose corresponding element is a legend element" work? Assuming we also keep the other conditions already in the standard.

@emilio
Copy link
Contributor Author

emilio commented Jan 19, 2018

I think that would match what's implemented in both blink and Gecko at least.

@emilio
Copy link
Contributor Author

emilio commented Jan 19, 2018

(And WebKit too, just checked).

May be worth to check edge in case it does something different, but I can't do that easily.

@zcorpan
Copy link
Member

zcorpan commented Aug 13, 2018

You could construct another with Shadow DOM adding a <slot> under a <fieldset> and slotting a <legend> inside.

Like this?

https://software.hixie.ch/utilities/js/live-dom-viewer/saved/6080

This seems to work in WebKit/Chromium/Gecko. (In EdgeHTML 17, customElements is not defined.)

@zcorpan
Copy link
Member

zcorpan commented Aug 13, 2018

To confirm, the wording suggested above ("first child box whose corresponding element is a legend element") would include the flat tree case?

@emilio
Copy link
Contributor Author

emilio commented Aug 23, 2018

Yes, it would. Elements outside of the flat tree don't generate boxes (or have styles for that matter).

zcorpan added a commit to web-platform-tests/wpt that referenced this issue Aug 23, 2018
zcorpan added a commit to web-platform-tests/wpt that referenced this issue Aug 23, 2018
zcorpan added a commit to web-platform-tests/wpt that referenced this issue Aug 27, 2018
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 29, 2018
…display: contents, a=testonly

Automatic update from web-platform-testsHTML: test fieldset with shadow DOM and display: contents

See whatwg/html#3331

--

wpt-commits: 69e18d06f5030e3567dcf323e24452c7f4b5f6df
wpt-pr: 12643
jankeromnes pushed a commit to jankeromnes/gecko that referenced this issue Aug 29, 2018
…display: contents, a=testonly

Automatic update from web-platform-testsHTML: test fieldset with shadow DOM and display: contents

See whatwg/html#3331

--

wpt-commits: 69e18d06f5030e3567dcf323e24452c7f4b5f6df
wpt-pr: 12643
zcorpan added a commit that referenced this issue Sep 19, 2018
Properly define the rendering of the fieldset and legend elements.

The layout model used is most similar to Gecko, which uses an anonymous box to hold the fieldset's contents.

Fixes #3955, fixes #3930, fixes #3929, fixes #3928, fixes #3927, fixes #3915, fixes #3913, fixes #3660, fixes #3331, fixes #2756, fixes #4013.

Tests:
https://github.com/web-platform-tests/wpt/tree/master/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements
https://github.com/web-platform-tests/wpt/tree/master/html/semantics/forms/the-fieldset-element
mustaqahmed pushed a commit to mustaqahmed/html that referenced this issue Feb 15, 2019
mustaqahmed pushed a commit to mustaqahmed/html that referenced this issue Feb 15, 2019
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 3, 2019
…display: contents, a=testonly

Automatic update from web-platform-testsHTML: test fieldset with shadow DOM and display: contents

See whatwg/html#3331

--

wpt-commits: 69e18d06f5030e3567dcf323e24452c7f4b5f6df
wpt-pr: 12643

UltraBlame original commit: 746986266e94d0af5def61af3941b2a69bd76324
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 3, 2019
…display: contents, a=testonly

Automatic update from web-platform-testsHTML: test fieldset with shadow DOM and display: contents

See whatwg/html#3331

--

wpt-commits: 69e18d06f5030e3567dcf323e24452c7f4b5f6df
wpt-pr: 12643

UltraBlame original commit: 746986266e94d0af5def61af3941b2a69bd76324
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 3, 2019
…display: contents, a=testonly

Automatic update from web-platform-testsHTML: test fieldset with shadow DOM and display: contents

See whatwg/html#3331

--

wpt-commits: 69e18d06f5030e3567dcf323e24452c7f4b5f6df
wpt-pr: 12643

UltraBlame original commit: 746986266e94d0af5def61af3941b2a69bd76324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop Implementations are not interoperable with each other topic: fieldset topic: rendering
Development

Successfully merging a pull request may close this issue.

3 participants