Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M MathJax
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MathJax
  • MathJax
  • Issues
  • #2662
Closed
Open
Issue created Mar 24, 2021 by Administrator@rootContributor

MathJax 3 completion handler fails if the content contains processing instructions

Created by: bthomale

Issue Summary

We found a bug where, when using tex-mml-chtml conversion, if the input file is xhtml containing a processing instruction, the completion handler never fires. Additionally, the javascript will show the following error in the console:

Unhandled Promise Rejection: TypeError: t.getAttribute is not a function. (In 't.getAttribute(e)', 't.getAttribute' is undefined)

We've replicated this in WebKit / Safari on macOS, iOS. And also in the embedded webkit view in Android.

Essentially, it's iterating through the content looking at the "class" attribute of various nodes. Somehow it is assuming they're all elements, and when it hits a processing instruction node (where getAttribute is not defined) it throws this error. You can see exactly what is happening if you turn on "break on exceptions" in the WebKit debugger.

We noticed that it only happens during TEX input processing, which we don't need. Turning off TEX works around the problem, which is what we have done. But it's still a bug, so I thought you might be interested in looking at it.

I've included 3 different versions of the file to illustrate this:

  1. tex-mml-chtml-with-pi.xhtml

This is the one that fails. It has a completion handler defined that logs "done" to the console. If you open up the console you'll see the error I described, and "done" is never logged.

  1. tex-mml-chtml-no-pi.xhtml

This illustrates that without the pi the example completes successfully and logs "done" to the console.

  1. mml-chtml-with-pi.xhtml

This illustrates that with the pi, but with mml-chtml ONLY (no TEX) it also completes successfully and logs "done" to the console.

Steps to Reproduce:

  1. Open the attached file tex-mml-chtml-with-pi.xhtml
  2. Open the debug console
  3. Refresh the page. You'll see the error and that "done" is never logged.

Technical details:

  • MathJax Version: 3.1.2
  • Client OS: macOS 11.2.3
  • Browser: Safari 14.0.3

^ I was able to replicate with that. Easier than trying to reproduce with mobile.

Supporting information:

tex-pi-bug.zip

See the above attached zip for the promised example files. Just open them in Safari.

Assignee
Assign to
Time tracking