MathML polyfill

Looking for WET v3.1?

As of September 23, 2014, version 3.1 of the Web Experience Toolkit is no longer supported. The source code and documentation have been moved to the wet-boew-legacy repository.

Questions or comments?

Purpose

MathML enables the display of mathematical formulas. Because some browsers do not support this functionality natively, this polyfill emulates the same functionality using MathJax.

Known issues

  1. Browsers that lack both MathML and SVG support (e.g., IE8 - IE9) will take longer to load MathML than browsers with either SVG or MathML support
  2. IE8 takes a lot longer to load MathML than IE9 (known MathJax reflow issue)
  3. Pages with a lot of complex formulas can take a few minutes to load on slow machines running IE8 (known MathJax issue)

Working example

How to implement

To use the polyfill, standard MathML is required. In cases where a browser doesn't support MathML, the polyfill is automatically loaded.

Configuration options

Configuration options available for MathML (MathML 3.0 specification)

Events

Event Trigger What it does
wb-init.wb-math (v4.0.5+) Triggered manually (e.g., $( "math" ).trigger( "wb-init.wb-math" );). Used to manually initialize the MathML polyfill. Note: The MathML polyfill will be initialized automatically unless the math element is added after the page has already loaded.
wb-ready.wb-math (v4.0.5+) Triggered automatically after the MathML polyfill initializes. Note: This event will only be triggered if the polyfill is loaded. The polyfill will not load for browsers with adequate native MathML support. Used to identify when the MathML polyfill initializes (target of the event)
$( document ).on( "wb-ready.wb-math", function( event ) {
});
wb-ready.wb (v4.0.5+) Triggered automatically when WET has finished loading and executing. Used to identify when all WET plugins and polyfills have finished loading and executing.
$( document ).on( "wb-ready.wb", function( event ) {
});

Source code

MathML polyfill source code on GitHub (also in wb.js)

Date modified: