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

::before and ::after pseudo-elements #247

Open
runarberg opened this issue Jun 4, 2024 · 4 comments
Open

::before and ::after pseudo-elements #247

runarberg opened this issue Jun 4, 2024 · 4 comments
Labels

Comments

@runarberg
Copy link

runarberg commented Jun 4, 2024

I’ve noticed that Chrome does not render the ::before and ::after pseudo-elements. The spec doesn’t appear to specify whether they should or shouldn’t be supported. I would expect that most CSS features would be supported unless explicitly specified not to.

My use case was trying to implement something like the old <menclose notation="downdiagonalstrike"> with CSS:

<mrow class="cancel">
  <mn>1</mn><mo>+</mo><mn>1</mn>
</mrow>
.cancel {
  position: relative;
}

.cancel::after {
  background: linear-gradient(
    to bottom right,
    transparent calc(50% - 0.1ex),
    currentColor calc(50% - 0.05ex),
    currentColor calc(50% + 0.05ex),
    transparent calc(50% + 0.1ex)
  );
  content: "";
  inset: 0;
  position: absolute;
}

I could off course just add the background to the original element, but if the line is a different color than the content, then the line is drawn behind the content.

@runarberg
Copy link
Author

Note, absolute positioning on MathML elements seems not to be implemented in firefox.

@dginev
Copy link

dginev commented Jun 4, 2024

Cross-referencing a similar discussion from the SVG WG, which may be useful related work to be aware of:
w3c/svgwg#125

@NSoiffer
Copy link
Contributor

Although my comment doesn't address ::before and ::after, it may help solve @runarberg's needs...

Several years ago I wrote polyfills for Core and that includes a polyfill for menclose. The code is at https://github.com/w3c/mathml-polyfills/blob/main/menclose/menclose.js. It handles all the menclose notation attributes including arrows (impressive CSS that I borrowed and slightly modified from MathJaX). You can see the polyfill in action here. The lines are the same color as the text, but I think it is not hard to change that.

@bkardell
Copy link
Collaborator

bkardell commented Jul 29, 2024

The Working Group discussed this today and while we believe this is interesting,
we also believe it is probably unlikely that we can feasibly get generated content sorted out for MathML-Core Level 1 (the related SVG issue has been open for ~8 years, for example). For now our main focus is on landing a stable, well specified and interoperable level 1 across implementations - that may lead to implementation questions that give this topic energy, but it's not clear yet. We've moved this to level 2 for now, but will revisit as we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants