diff options
Diffstat (limited to 'layout/mathml/tests/stretchy-and-large-operators.html')
-rw-r--r-- | layout/mathml/tests/stretchy-and-large-operators.html | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/layout/mathml/tests/stretchy-and-large-operators.html b/layout/mathml/tests/stretchy-and-large-operators.html new file mode 100644 index 000000000..13fe14aa7 --- /dev/null +++ b/layout/mathml/tests/stretchy-and-large-operators.html @@ -0,0 +1,88 @@ +<!-- -*- mode: HTML; tab-width: 2; indent-tabs-mode: nil; -*- --> +<!-- vim: set tabstop=2 expandtab shiftwidth=2 textwidth=80: --> +<!DOCTYPE html> +<html> + <head> + <title>Test Stretchy and Large Operators</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + <script type="text/javascript" + src="stretchy-and-large-operators.js"></script> + <script type="text/javascript"> + + var mathml = "http://www.w3.org/1998/Math/MathML"; + + function createMo(aOperator, aForm) + { + var mo = document.createElementNS(mathml, "mo"); + mo.appendChild(document.createTextNode(aOperator)); + mo.setAttribute("form", aForm); + return mo; + } + + function createTest(aEntry) + { + var opname = aEntry[0]; + var operator = aEntry[1]; + var type = aEntry[2]; + var form = aEntry[3]; + + var div = document.createElement("div"); + div.appendChild(document.createTextNode(opname)); + + var math = document.createElementNS(mathml, "math"); + + switch (type) + { + case "l": // largeop + math.appendChild(createMo(operator, form)); + var mstyle = document.createElementNS(mathml, "mstyle"); + mstyle.setAttribute("displaystyle", "true"); + mstyle.appendChild(createMo(operator, form)); + math.appendChild(mstyle); + break; + + case "v": // vertical + for (var i = 1; i < 10; i+=2) { + var mo = createMo(operator, form); + mo.setAttribute("minsize", (.5 * i) + "em"); + math.appendChild(mo); + } + break; + + case "h": // horizontal + for (var i = 1; i < 10; i+=2) { + var mo = createMo(operator, form); + var mspace = document.createElementNS(mathml, "mspace"); + mspace.setAttribute("width", (.5 * i) + "em"); + var mover = document.createElementNS(mathml, "mover"); + mover.setAttribute("accent", "false"); + mover.appendChild(mspace); + mover.appendChild(mo); + math.appendChild(mover); + } + break; + + default: + break; + } + + div.appendChild(math); + document.body.appendChild(div); + } + + function init() + { + for (var i in stretchy_and_large_operators) { + createTest(stretchy_and_large_operators[i]); + } + } + </script> + </head> + + <body onload="init()"> + + </body> +</html> |