scriptshift

This page uses <script type="module"> with relative import paths. Browsers usually block those imports from the file:// URL, so the polyfill will not run if you open this file directly from disk. Serve the repository root over HTTP and open this page from there, for example: python -m http.server 8080 then visit http://localhost:8080/scriptshift/index.html.

Tests for the scriptshift.js polyfill: MathML 4 subscriptshift / superscriptshift on msub, msup, and msubsup. Each row compares the default (no shift attribute) with a shifted script after _MathTransforms.transform runs. The blue border is tight and indicates the MathML element's bounding box.

msub — subscript baseline shifted down
Description No subscriptshift (reference) subscriptshift="0.5em" (polyfilled)
Simple subscript x 0 x 0
Nested subscript (i sub j) A i j A i j
msup — superscript baseline shifted up
Description No superscriptshift (reference) superscriptshift="0.5em" (polyfilled)
Simple superscript x 2 x 2
e to the t squared (nested superscript) e t 2 e t 2
msubsup — sub down and super up
Description No shift attrs (reference) Both shifts (polyfilled) Sub only / super only
Integral-style limits 0 1 0 1 x a b y c d
Variable with sub/sup pair X i j X i j Z 1 2 W 3 4

Pixel lengths

Sanity check with absolute lengths:

p 1 , p 2 , p 3 4