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
  • #1584
Closed
Open
Issue created Aug 16, 2016 by Administrator@rootContributor

MathJax.Hub.Queue fails when called from GWT function

Created by: kevinushey

I'm running into trouble using MathJax within a GWT project. I have a GWT function using the native JSNI interface e.g.

    private static final native void mathjaxTypeset(String text, Element el) /*-{
      var MathJax = $wnd.MathJax;
      var f = function(x) { alert(x); };
      MathJax.Hub.Queue([f, 15]);
    }-*/;

Unfortunately, this fails for the reasons outlined by https://github.com/mathjax/MathJax/issues/508 -- we get a MathJax error of the form

<...> Can't make callback from given data

This ultimately stems from MathJax's use of args instanceof Array -- within the context of GWT, this check fails.

screen shot 2016-08-16 at 3 46 01 pm

You'll notice that instanceof Array returns false, despite other checks reporting that this is indeed an array. Could this condition be relaxed to use a helper function e.g.

function isArray(object) {
    return Object.prototype.toString.call(object) === "[object Array]";
}

Or even Array.isArray() would suffice here.

Thanks! Kevin

Assignee
Assign to
Time tracking