Skip to content

Make display:contents map to display:none #90

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

Closed
fred-wang opened this issue May 16, 2019 · 11 comments
Closed

Make display:contents map to display:none #90

fred-wang opened this issue May 16, 2019 · 11 comments
Labels
css / html5 Issues related to CSS or HTML5 interoperability MathML Core Issues affecting the MathML Core specification

Comments

@fred-wang
Copy link

cc @rwlbuis @bkardell @mrego @emilio

From https://drafts.csswg.org/css-display/#unbox-mathml

For all MathML elements, display: contents computes to display: none.

TODO: check the implementation status in webkit/firefox and write tests for these.
Rob did https://github.com/Igalia/chromium-dev/commit/177eb951392219339c47526c65c1789439a1d6b0

@fred-wang fred-wang added css / html5 Issues related to CSS or HTML5 interoperability MathML Core Issues affecting the MathML Core specification need implementation update need specification update Issues requiring specification changes need tests Issues related to writing WPT tests labels May 16, 2019
@fred-wang
Copy link
Author

Probably we can also add a note in the core spec, pointing to https://drafts.csswg.org/css-display/#unbox-mathml

@emilio
Copy link

emilio commented May 16, 2019

@fred-wang
Copy link
Author

Thanks @emilio , yes I think I saw this code recently :-)
Adding the rules in WebKit/Chromium and writing a WPT test should be easy.

@fred-wang
Copy link
Author

Spec update: w3c/mathml-core@d4bb13a

@fred-wang fred-wang removed the need specification update Issues requiring specification changes label Jun 3, 2019
@Jamesernator
Copy link

Jamesernator commented Aug 23, 2019

Any chance of getting a dedicated mathml element that functions like display: contents;? Currently there's no way to group elements (e.g. within a <mrow>).

e.g.:

<mrow>
  <!-- Would have styles effectively like display: contents -->
  <mgroup id="energyTerm">
    <mi>E</mi>
  </mgroup>
  <mo>=</mo>
  <mgroup id="resultTerm">
    <mi>m</mi>
    <mo>&InvisibleTimes;</mo>
    <msup>
      <mi>c</mi>
      <mn>2</mn>
    </msup>
  </mgroup>
</mrow>

@fred-wang
Copy link
Author

@Jamesernator In the short term, I personally don't think we are going to introduce new MathML elements in MathML Core since the goal is to try to find a core subset to implement in browsers. We are doing more css compat work, so maybe we could reopen the discussion in the future about display: contents (w3c/csswg-drafts#2167) if there are concrete/important use cases for it. It's not obvious to why it's needed in your example, using an explicit mrow is a better grouping (resultTerm) or equivalent to the element alone (energyTerm).

@Jamesernator
Copy link

The example isn't very good I just wanted to be short, this is a better example:

<!doctype html>

<style>
  #container {
    border: 1px solid grey;
    width: 100px;
  }

  #firstTerm:hover {
    color: green;
  }

  #restOfSeries:hover {
    color: blue;
  }
</style>

<div id="container">
  <math>
    <mn id="firstTerm">1</mn>
    <mo>+</mo>
    <mgroup id="restOfSeries">
      <mi>A</mi>
      <mo>+</mo>
      <msup>
        <mi>A</mi>
        <mi>2</mi>
      </msup>
      <mo>+</mo>
      <msup>
        <mi>A</mi>
        <mi>3</mi>
      </msup>
      <mo>+</mo>
      <msup>
        <mi>A</mi>
        <mi>4</mi>
      </msup>
      <mo>+</mo>
      <mi>...</mi>
    </mgroup>
  </math>
</div>

This can't be replaced with <mrow> because <mrow> does not break when there's insufficient space.

e.g. With an <mgroup> suggested element or display: contents on something it'd look like:

Screen Shot 2019-08-26 at 6 19 45 pm

But trying to use <mrow> for this doesn't work because it doesn't break:

Screen Shot 2019-08-26 at 6 21 41 pm

fred-wang added a commit to w3c/mathml-core that referenced this issue Aug 26, 2019
@fred-wang
Copy link
Author

@Jamesernator OK, I guess you are testing in Gecko? Ideally linebreaking should be improved and supported in any mrow, so you won't need such an mgroup element ( w3c/mathml-core#127 ). But defining a full linebreaking is going to be tricky so it's also postponed for later until we sort out the other issues...

@Jamesernator
Copy link

OK, I guess you are testing in Gecko?

Yes. I had looked for overflow: linebreak in the mathml core spec but couldn't find it so I supposed it had been removed, didn't notice the "Define MathML line breaking?" boxes.

@NSoiffer
Copy link
Contributor

The MathML 3 spec has a section on linebreaking: https://www.w3.org/TR/MathML3/chapter3.html#presm.linebreaking. As @fred-wang said, it is not well supported in Gecko and other places. I suspect we will revisit linebreaking for core to see what can be done to make it easier to implement, but that's a lower priority item.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 29, 2019
…L elements, a=testonly

Automatic update from web-platform-tests
Add tests for display: contents on MathML elements (#18668)

w3c/mathml#90
--

wpt-commits: 94a0b420301fc9d7da16097083ecdce927e22343
wpt-pr: 18668
xeonchen pushed a commit to xeonchen/gecko that referenced this issue Aug 30, 2019
…L elements, a=testonly

Automatic update from web-platform-tests
Add tests for display: contents on MathML elements (#18668)

w3c/mathml#90
--

wpt-commits: 94a0b420301fc9d7da16097083ecdce927e22343
wpt-pr: 18668
@fred-wang fred-wang removed the need tests Issues related to writing WPT tests label Sep 16, 2019
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 4, 2019
…L elements, a=testonly

Automatic update from web-platform-tests
Add tests for display: contents on MathML elements (#18668)

w3c/mathml#90
--

wpt-commits: 94a0b420301fc9d7da16097083ecdce927e22343
wpt-pr: 18668

UltraBlame original commit: 518f1d58aca0f6172291259876cedb195550e53f
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 4, 2019
…L elements, a=testonly

Automatic update from web-platform-tests
Add tests for display: contents on MathML elements (#18668)

w3c/mathml#90
--

wpt-commits: 94a0b420301fc9d7da16097083ecdce927e22343
wpt-pr: 18668

UltraBlame original commit: 518f1d58aca0f6172291259876cedb195550e53f
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 4, 2019
…L elements, a=testonly

Automatic update from web-platform-tests
Add tests for display: contents on MathML elements (#18668)

w3c/mathml#90
--

wpt-commits: 94a0b420301fc9d7da16097083ecdce927e22343
wpt-pr: 18668

UltraBlame original commit: 518f1d58aca0f6172291259876cedb195550e53f
bhearsum pushed a commit to mozilla-releng/staging-firefox that referenced this issue May 1, 2025
…L elements, a=testonly

Automatic update from web-platform-tests
Add tests for display: contents on MathML elements (#18668)

w3c/mathml#90
--

wpt-commits: 94a0b420301fc9d7da16097083ecdce927e22343
wpt-pr: 18668
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css / html5 Issues related to CSS or HTML5 interoperability MathML Core Issues affecting the MathML Core specification
Projects
None yet
Development

No branches or pull requests

4 participants