File: math-parse01.html

package info (click to toggle)
thunderbird 1%3A143.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,703,968 kB
  • sloc: cpp: 7,770,492; javascript: 5,943,842; ansic: 3,918,754; python: 1,418,263; xml: 653,354; asm: 474,045; java: 183,079; sh: 111,238; makefile: 20,410; perl: 14,359; objc: 13,059; yacc: 4,583; pascal: 3,405; lex: 1,720; ruby: 999; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 69; csh: 10
file content (62 lines) | stat: -rw-r--r-- 2,175 bytes parent folder | download | duplicates (69)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<title>math in html: parsing</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>math in html: parsing</h1>

<div id="log" style="display:block"></div>

<div style="display:none">
<div><math id="m1"><mtext/></math></div>
<div id="d1"><math><mrow/><mi/></math></div>
<div id="d2"><math><mrow><mrow><mn>1</mn></mrow><mi>a</mi></mrow></math></div>
<div id="d3">&lang;&rang;</div>
<div id="d4">&Kopf;</div>
<div id="d5"><math><semantics><mi>a</mi><annotation-xml><foo/><bar/></annotation-xml></semantics></math></div>
<div id="d6"><math><semantics><mi>a</mi><annotation-xml encoding="text/html"><div></div></annotation-xml></semantics><mn/></math>
</div>


<script>

test(function() {
assert_equals(document.getElementById("m1"),document.getElementsByTagName("math")[0]);
},"The id attribute should be recognised on math elements");

test(function() {
assert_equals(document.getElementById("d1").firstChild.nodeName,"math")
},"The node name should be math");

test(function() {
assert_equals(document.getElementById("d1").firstChild.namespaceURI ,"http://www.w3.org/1998/Math/MathML")
},"math should be in MathML Namespace");

test(function() {
assert_equals(document.getElementById("d1").firstChild.childNodes.length ,2)
},"Math has 2 children (empty tag syntax)");

test(function() {
assert_equals(document.getElementById("d2").firstChild.childNodes.length ,1)
},"Nested mrow elements should be parsed correctly");

test(function() {
assert_equals(document.getElementById("d3").firstChild.nodeValue ,"\u27E8\u27E9")
},"Testing rang and lang entity code points");

test(function() {
assert_equals(document.getElementById("d4").firstChild.nodeValue ,"\uD835\uDD42")
},"Testing Kopf (Plane 1) entity code point");

test(function() {
assert_equals(document.getElementById("d5").firstChild.firstChild.childNodes[1].childNodes.length ,2)
},"Empty element tags in annotation-xml parsed as per XML.");

test(function() {
assert_equals(document.getElementById("d6").firstChild.childNodes.length ,2)
},"html tags allowed in annotation-xml/@encoding='text/html'.");

</script>