Repository navigation
Description
In #1 we decided to restrict mstyle attributes to a small set of attributes that can be mapped to CSS i.e. displaystyle, dir, mathsize, mathbackground, mathcolor, mathvariant and scriptlevel. Other MathML elements support mstyle attributes, but this is a bit messy:
- The math element accepts all mstyle attributes: https://mathml-refresh.github.io/mathml/chapter2.html#interf.toplevel.atts
- mathcolor, mathbackground are accepted on all presentation elements: https://mathml-refresh.github.io/mathml/chapter3.html#presm.presatt
- mathvariant, mathsize, dir are accepted on all token elements: https://mathml-refresh.github.io/mathml/chapter3.html#presm.commatt ; same for other deprecated attributes https://mathml-refresh.github.io/mathml/chapter3.html#presm.deprecatt
- dir is supported on mrow: https://mathml-refresh.github.io/mathml/chapter3.html#id.3.3.1.2
- displaystyle is supported on mtable: https://mathml-refresh.github.io/mathml/chapter3.html#presm.mtable.attrs
(Incidentally, href is not an mstyle-specific attribute but it has to be handled on all MathML elements: https://mathml-refresh.github.io/mathml/chapter2.html#fund.globatt )
As a consequence, browser implementers have to check whether each mstyle attribute is allowed on a given element before mapping it. Also, WPT tests should really check all these cases about whether or not an attribute has an effect on a given element.
I think it would be easier to allow the presentational attributes listed above on any (presentation) MathML element. For browser implementations, mapping attributes to CSS is straightforward and that will remove special checks for element / attribute pairs. For the spec, I believe there is no longer any name conflicts between (before #1 we could have issues with e.g. mpadded@width, mtable@width, mspace@width).
Doing that will also remove the need for mstyle #1 (comment)
Activity
fred-wang commentedon May 7, 2019
@rwlbuis: displaystyle (display), scriptlevel and maybe dir might be problematic to handle because they are currently not just mapped to CSS in the element class but instead have some special rules in the UA stylesheet. So extending to any element might mean adding universal selectors (which are prohibited in Chromium UA stylesheet). We would need to investigate what you mentioned about doing this kind of advanced CSS mapping in the C++ code instead.
rwlbuis commentedon May 7, 2019
I checked, we already map dir to the CSS property direction internally.
fred-wang commentedon May 16, 2019
Notes are not published, I don't remember what we decided at the end.
NSoiffer commentedon May 20, 2019
We decided to table the issue until we understand how a polyfills will be used for mstyle all the time or not (about 28 minutes into the recording).
fred-wang commentedon Jun 3, 2019
Consensus was to allow the following mstyle attributes:
displaystyle
dir
mathsize
mathbackground
mathcolor
mathvariant
scriptlevel
on all MathML elements so that browser implementers just need to map them without checking the tag. This has nothing to do with how polyfill will support the removed attributes AFAIK.
fred-wang commentedon Jun 4, 2019
Core spec updated: https://mathml-refresh.github.io/mathml-core/#mstyle
fred-wang commentedon Sep 16, 2019
We have tests for that, at least
https://w3c-test.org/mathml/relations/css-styling/attribute-mapping-001.html
https://w3c-test.org/mathml/relations/css-styling/attribute-mapping-002.html
NSoiffer commentedon May 20, 2020
I'm removing the 'need polyfill' label because I think the needed polyfill is referenced in #1. Allowing the above referenced values on all elements doesn't require a polyfill to be written.
If I missed something that differs from #1 in needed a polyfill, please clarify (for me) and add the label back.