layout/mathml/tests/stretchy-and-large-operators.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/mathml/tests/stretchy-and-large-operators.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,88 @@
     1.4 +<!-- -*- mode: HTML; tab-width: 2; indent-tabs-mode: nil; -*- -->
     1.5 +<!-- vim: set tabstop=2 expandtab shiftwidth=2 textwidth=80:  -->
     1.6 +<!DOCTYPE html>
     1.7 +<html>
     1.8 +  <head>
     1.9 +    <title>Test Stretchy and Large Operators</title>
    1.10 +    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    1.11 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
    1.12 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
    1.13 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
    1.14 +    <script type="text/javascript"
    1.15 +            src="stretchy-and-large-operators.js"></script>
    1.16 +    <script type="text/javascript">
    1.17 +
    1.18 +      var mathml = "http://www.w3.org/1998/Math/MathML";
    1.19 +
    1.20 +      function createMo(aOperator, aForm)
    1.21 +      {
    1.22 +        var mo = document.createElementNS(mathml, "mo");
    1.23 +        mo.appendChild(document.createTextNode(aOperator));
    1.24 +        mo.setAttribute("form", aForm);
    1.25 +        return mo;
    1.26 +      }
    1.27 +
    1.28 +      function createTest(aEntry)
    1.29 +      {
    1.30 +        var opname = aEntry[0];
    1.31 +        var operator = aEntry[1];
    1.32 +        var type = aEntry[2];
    1.33 +        var form = aEntry[3];
    1.34 +
    1.35 +        var div = document.createElement("div");
    1.36 +        div.appendChild(document.createTextNode(opname));
    1.37 +
    1.38 +        var math = document.createElementNS(mathml, "math");
    1.39 +
    1.40 +        switch (type)
    1.41 +        {
    1.42 +          case "l": // largeop
    1.43 +            math.appendChild(createMo(operator, form));
    1.44 +            var mstyle = document.createElementNS(mathml, "mstyle");
    1.45 +            mstyle.setAttribute("displaystyle", "true");
    1.46 +            mstyle.appendChild(createMo(operator, form));
    1.47 +            math.appendChild(mstyle);
    1.48 +          break;
    1.49 +
    1.50 +          case "v": // vertical
    1.51 +            for (var i = 1; i < 10; i+=2) {
    1.52 +              var mo = createMo(operator, form);
    1.53 +              mo.setAttribute("minsize", (.5 * i) + "em");
    1.54 +              math.appendChild(mo);
    1.55 +            }
    1.56 +          break;
    1.57 +
    1.58 +          case "h": // horizontal
    1.59 +            for (var i = 1; i < 10; i+=2) {
    1.60 +              var mo = createMo(operator, form);
    1.61 +              var mspace = document.createElementNS(mathml, "mspace");
    1.62 +              mspace.setAttribute("width", (.5 * i) + "em");
    1.63 +              var mover = document.createElementNS(mathml, "mover");
    1.64 +              mover.setAttribute("accent", "false");
    1.65 +              mover.appendChild(mspace);
    1.66 +              mover.appendChild(mo);
    1.67 +              math.appendChild(mover);
    1.68 +            }
    1.69 +          break;
    1.70 +
    1.71 +          default:
    1.72 +          break;
    1.73 +        }
    1.74 +
    1.75 +        div.appendChild(math);
    1.76 +        document.body.appendChild(div);
    1.77 +      }
    1.78 +
    1.79 +      function init()
    1.80 +      {
    1.81 +        for (var i in stretchy_and_large_operators) {
    1.82 +          createTest(stretchy_and_large_operators[i]);
    1.83 +        }
    1.84 +      }
    1.85 +    </script>
    1.86 +  </head>
    1.87 +
    1.88 +  <body onload="init()">
    1.89 +
    1.90 + </body>
    1.91 +</html>

mercurial