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

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

mercurial