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

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 <!-- -*- mode: HTML; tab-width: 2; indent-tabs-mode: nil; -*- -->
     2 <!-- vim: set tabstop=2 expandtab shiftwidth=2 textwidth=80:  -->
     3 <!DOCTYPE html>
     4 <html>
     5   <head>
     6     <title>Test Stretchy and Large Operators</title>
     7     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     8 <!-- This Source Code Form is subject to the terms of the Mozilla Public
     9    - License, v. 2.0. If a copy of the MPL was not distributed with this
    10    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
    11     <script type="text/javascript"
    12             src="stretchy-and-large-operators.js"></script>
    13     <script type="text/javascript">
    15       var mathml = "http://www.w3.org/1998/Math/MathML";
    17       function createMo(aOperator, aForm)
    18       {
    19         var mo = document.createElementNS(mathml, "mo");
    20         mo.appendChild(document.createTextNode(aOperator));
    21         mo.setAttribute("form", aForm);
    22         return mo;
    23       }
    25       function createTest(aEntry)
    26       {
    27         var opname = aEntry[0];
    28         var operator = aEntry[1];
    29         var type = aEntry[2];
    30         var form = aEntry[3];
    32         var div = document.createElement("div");
    33         div.appendChild(document.createTextNode(opname));
    35         var math = document.createElementNS(mathml, "math");
    37         switch (type)
    38         {
    39           case "l": // largeop
    40             math.appendChild(createMo(operator, form));
    41             var mstyle = document.createElementNS(mathml, "mstyle");
    42             mstyle.setAttribute("displaystyle", "true");
    43             mstyle.appendChild(createMo(operator, form));
    44             math.appendChild(mstyle);
    45           break;
    47           case "v": // vertical
    48             for (var i = 1; i < 10; i+=2) {
    49               var mo = createMo(operator, form);
    50               mo.setAttribute("minsize", (.5 * i) + "em");
    51               math.appendChild(mo);
    52             }
    53           break;
    55           case "h": // horizontal
    56             for (var i = 1; i < 10; i+=2) {
    57               var mo = createMo(operator, form);
    58               var mspace = document.createElementNS(mathml, "mspace");
    59               mspace.setAttribute("width", (.5 * i) + "em");
    60               var mover = document.createElementNS(mathml, "mover");
    61               mover.setAttribute("accent", "false");
    62               mover.appendChild(mspace);
    63               mover.appendChild(mo);
    64               math.appendChild(mover);
    65             }
    66           break;
    68           default:
    69           break;
    70         }
    72         div.appendChild(math);
    73         document.body.appendChild(div);
    74       }
    76       function init()
    77       {
    78         for (var i in stretchy_and_large_operators) {
    79           createTest(stretchy_and_large_operators[i]);
    80         }
    81       }
    82     </script>
    83   </head>
    85   <body onload="init()">
    87  </body>
    88 </html>

mercurial