tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

math-parse01.html (2175B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>math in html: parsing</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 </head>
      8 <body>
      9 <h1>math in html: parsing</h1>
     10 
     11 <div id="log" style="display:block"></div>
     12 
     13 <div style="display:none">
     14 <div><math id="m1"><mtext/></math></div>
     15 <div id="d1"><math><mrow/><mi/></math></div>
     16 <div id="d2"><math><mrow><mrow><mn>1</mn></mrow><mi>a</mi></mrow></math></div>
     17 <div id="d3">&lang;&rang;</div>
     18 <div id="d4">&Kopf;</div>
     19 <div id="d5"><math><semantics><mi>a</mi><annotation-xml><foo/><bar/></annotation-xml></semantics></math></div>
     20 <div id="d6"><math><semantics><mi>a</mi><annotation-xml encoding="text/html"><div></div></annotation-xml></semantics><mn/></math>
     21 </div>
     22 
     23 
     24 <script>
     25 
     26 test(function() {
     27 assert_equals(document.getElementById("m1"),document.getElementsByTagName("math")[0]);
     28 },"The id attribute should be recognised on math elements");
     29 
     30 test(function() {
     31 assert_equals(document.getElementById("d1").firstChild.nodeName,"math")
     32 },"The node name should be math");
     33 
     34 test(function() {
     35 assert_equals(document.getElementById("d1").firstChild.namespaceURI ,"http://www.w3.org/1998/Math/MathML")
     36 },"math should be in MathML Namespace");
     37 
     38 test(function() {
     39 assert_equals(document.getElementById("d1").firstChild.childNodes.length ,2)
     40 },"Math has 2 children (empty tag syntax)");
     41 
     42 test(function() {
     43 assert_equals(document.getElementById("d2").firstChild.childNodes.length ,1)
     44 },"Nested mrow elements should be parsed correctly");
     45 
     46 test(function() {
     47 assert_equals(document.getElementById("d3").firstChild.nodeValue ,"\u27E8\u27E9")
     48 },"Testing rang and lang entity code points");
     49 
     50 test(function() {
     51 assert_equals(document.getElementById("d4").firstChild.nodeValue ,"\uD835\uDD42")
     52 },"Testing Kopf (Plane 1) entity code point");
     53 
     54 test(function() {
     55 assert_equals(document.getElementById("d5").firstChild.firstChild.childNodes[1].childNodes.length ,2)
     56 },"Empty element tags in annotation-xml parsed as per XML.");
     57 
     58 test(function() {
     59 assert_equals(document.getElementById("d6").firstChild.childNodes.length ,2)
     60 },"html tags allowed in annotation-xml/@encoding='text/html'.");
     61 
     62 </script>