Skip to content

Avoid using deprecated mathvariant attribute #3389

@wojciech-graj

Description

@wojciech-graj

Issue Summary

MathJax generates <mtext> with the mathvariant attribute set to a value other than "normal". This is deprecated per the Firefox 118 changelog. Additionally, it can no longer be used on any element other than <mi>.

Steps to Reproduce:

Use the following HTML

<div class="LATEX">
\begin{equation*}
\textbf{N}
\end{equation*}
</div>

And observe that the generated html looks as follows

<div class="LATEX">
    <mjx-container class="MathJax CtxtMenu_Attached_0" jax="CHTML" style="font-size: 121.4%; position: relative;" display="true" tabindex="0" ctxtmenu_counter="0">
        <mjx-math display="true" style="margin-left: 0px; margin-right: 0px;" class="MJX-TEX" aria-hidden="true">
            <mjx-mtext class="mjx-b">
                <mjx-c class="mjx-c1D40D TEX-B"></mjx-c>
            </mjx-mtext>
        </mjx-math>
        <mjx-assistive-mml unselectable="on" display="block"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mtext mathvariant="bold">N</mtext></math></mjx-assistive-mml>
    </mjx-container>
</div>

Firefox outputs the following warning:

“mathvariant='bold'” on MathML elements is deprecated and will be removed at a future date.

Technical details:

  • MathJax Version: 3.2
  • Client OS: Debian GNU/Linux 13 (trixie)
  • Browser: Mozilla Firefox 128.11.0esr

I am using the following MathJax configuration:

MathJax = {
};

and loading MathJax via

<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

Supporting information:

The following website will trigger the warning:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
</head>
<body>
<div class="LATEX">
\begin{equation*}
\textbf{N}
\end{equation*}
</div>
</body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions