|
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"> |
|
14 |
|
15 var mathml = "http://www.w3.org/1998/Math/MathML"; |
|
16 |
|
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 } |
|
24 |
|
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]; |
|
31 |
|
32 var div = document.createElement("div"); |
|
33 div.appendChild(document.createTextNode(opname)); |
|
34 |
|
35 var math = document.createElementNS(mathml, "math"); |
|
36 |
|
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; |
|
46 |
|
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; |
|
54 |
|
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; |
|
67 |
|
68 default: |
|
69 break; |
|
70 } |
|
71 |
|
72 div.appendChild(math); |
|
73 document.body.appendChild(div); |
|
74 } |
|
75 |
|
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> |
|
84 |
|
85 <body onload="init()"> |
|
86 |
|
87 </body> |
|
88 </html> |