mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.21k stars 1.16k forks source link

Lazy load does not typeset TeX in <option> #3006

Open AlexEdgcomb opened 1 year ago

AlexEdgcomb commented 1 year ago

Issue Summary

Lazy load does not typeset in <option> in MathJax 3.2.2, macOS 12.6, and Firefox 110.0.

Steps to Reproduce:

  1. Go to https://codepen.io/alexedgcomb/pen/eYLZxGZ Observed: Dropdown appears blank image

    Expected: Dropdown to have x/2

    image

Note: Clicking Force typeset (which runs MathJax.startup.document.lazyTypesetAll()) yields the expected result.

Technical details:

I am using the following MathJax configuration:

MathJax = {
    loader: {
        load: [ 'ui/lazy' ],
    },
};

and loading MathJax via

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

Supporting information:

Issue also reproduces in macOS 12.6 and Chrome 110. I have not tested other browser/OS combos.

Issue does not reproduce when lazy load is removed, i.e.:

MathJax = {};

I'm using the workaround of:

MathJax = {
    loader: {
        load: [ 'ui/lazy' ],
    },
    options: {
        lazyAlwaysTypeset: '.disable-lazy-typesetting',
    },
};

and <option class="disable-lazy-typesetting"> for each <option> with TeX

dpvc commented 1 year ago

Note that the contents of <option> is text only (e.g., see the HTML specification), and can not include styling or other layout, and so MathJax can't show typeset mathematics within <option> . The fact that MathJax processes the content of these elements is an error that should be fixed by adding select and option to the skipHtmlTags list. I will make a pull request to do so to fix this in the next release.

dpvc commented 1 year ago

I've made the pull request.