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

Comments

3 participants
@emilio
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 from The definition "rendered legend" should use the box tree, or at least the flat tree. to The definition of "rendered legend" should use the box tree, or at least the flat tree. Jan 6, 2018

@annevk

This comment has been minimized.

Show comment
Hide comment
@annevk

annevk Jan 6, 2018

Member

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

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 label Jan 6, 2018

@emilio

This comment has been minimized.

Show comment
Hide comment
@emilio

emilio Jan 6, 2018

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@annevk

annevk Jan 6, 2018

Member

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).

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

This comment has been minimized.

Show comment
Hide comment
@annevk

annevk Jan 6, 2018

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@emilio

emilio Jan 19, 2018

Contributor

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

Contributor

emilio commented Jan 19, 2018

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

@emilio

This comment has been minimized.

Show comment
Hide comment
@emilio

emilio Jan 19, 2018

Contributor

(And WebKit too, just checked).

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@zcorpan

zcorpan Aug 13, 2018

Member

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

Like this?

http://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.)

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?

http://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

This comment has been minimized.

Show comment
Hide comment
@zcorpan

zcorpan Aug 13, 2018

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@emilio

emilio Aug 23, 2018

Contributor

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

Contributor

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

Bug 1485711 [wpt PR 12643] - HTML: test fieldset with shadow DOM and …
…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

Bug 1485711 [wpt PR 12643] - HTML: test fieldset with shadow DOM and …
…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

Revamp how fieldset and legend rendering is defined
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment