| <!doctype html> | |
| <html> | |
| <head> | |
| <title>MathML script elements: removing children</title> | |
| <!-- This test verifies removal of children from an <mmultiscripts> element using DOM operations. It should not crash and should render the same as the equivalent static page. --> | |
| <style type="text/css"> | |
| div { border: 1px solid; margin: .5em; } | |
| </style> | |
| <script type="text/javascript"> | |
| var mathmlNS = "http://www.w3.org/1998/Math/MathML"; | |
| function testRemoveMPrescript(n) | |
| { | |
| // Test 1, 2, 3, 4: removing the <mprescripts/> element. | |
| var mmultiscripts = document.getElementById("test" + n).getElementsByTagNameNS(mathmlNS, "mmultiscripts"); | |
| for (var i = 0; i < mmultiscripts.length; i++) | |
| mmultiscripts[i].removeChild(mmultiscripts[i].getElementsByTagNameNS(mathmlNS, "mprescripts")[0]); | |
| } | |
| function test5() | |
| { | |
| // Test 5: removing the first duplicate <mprescripts/> element. | |
| var mmultiscripts = document.getElementById("test5").getElementsByTagNameNS(mathmlNS, "mmultiscripts"); | |
| for (var i = 0; i < mmultiscripts.length; i++) | |
| mmultiscripts[i].removeChild(mmultiscripts[i].getElementsByTagNameNS(mathmlNS, "mprescripts")[1]); | |
| } | |
| function test6() | |
| { | |
| // Test 6: removing an extra child. | |
| var mmultiscripts = document.getElementById("test6").getElementsByTagNameNS(mathmlNS, "mmultiscripts"); | |
| for (var i = 0; i < mmultiscripts.length; i++) { | |
| var extra = mmultiscripts[i].getElementsByTagNameNS(mathmlNS, "mprescripts")[1].nextSibling; | |
| for (var j = 0; j < i; j++) extra = extra.nextSibling; | |
| mmultiscripts[i].removeChild(extra); | |
| } | |
| } | |
| function test7() | |
| { | |
| // Test 7: removing the base. | |
| var mmultiscripts = document.getElementById("test7").getElementsByTagNameNS(mathmlNS, "mmultiscripts"); | |
| for (var i = 0; i < mmultiscripts.length; i++) { | |
| var base = mmultiscripts[i].firstChild; | |
| mmultiscripts[i].removeChild(base); | |
| } | |
| } | |
| function test8() | |
| { | |
| // Test 8: removing a postscript/prescript | |
| var mmultiscripts = document.getElementById("test8").getElementsByTagNameNS(mathmlNS, "mmultiscripts"); | |
| for (var i = 0; i < mmultiscripts.length; i++) { | |
| var script = mmultiscripts[i].getElementsByTagNameNS(mathmlNS, "mn")[i]; | |
| mmultiscripts[i].removeChild(script); | |
| } | |
| } | |
| function update() | |
| { | |
| testRemoveMPrescript(1); | |
| testRemoveMPrescript(2); | |
| testRemoveMPrescript(3); | |
| testRemoveMPrescript(4); | |
| test5(); | |
| test6(); | |
| test7(); | |
| test8(); | |
| } | |
| </script> | |
| </head> | |
| <body onload="update()"> | |
| <!-- Test 1: removing the <mprescripts/> element. | |
| (starting with no bases or postscripts) --> | |
| <div id="test1">Test 1: | |
| <math><mmultiscripts><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math> | |
| </div> | |
| <!-- Test 2: removing the <mprescripts/> element. | |
| (starting with one base but no postscripts --> | |
| <div id="test2">Test 2: | |
| <math><mmultiscripts><mn>20</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math> | |
| </div> | |
| <!-- Test 3: removing the <mprescripts/> element. | |
| (starting with one base but one postscript --> | |
| <div id="test3">Test 3: | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math> | |
| </div> | |
| <!-- Test 4: removing the <mprescripts/> element. | |
| (starting with one base and two postscripts) --> | |
| <div id="test4">Test 4: | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math> | |
| </div> | |
| <!-- Test 5: removing the first extra <mprescripts/> element. --> | |
| <div id="test5">Test 5: | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn></mmultiscripts></math> | |
| </div> | |
| <!-- Test 6: removing an extra child. --> | |
| <div id="test6">Test 6: | |
| <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math> | |
| </div> | |
| <!-- Test 7: removing the base. --> | |
| <div id="test7">Test 7: | |
| <math><mmultiscripts><mn>0</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mprescripts/></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mprescripts/><mn>5</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mn>0</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math> | |
| </div> | |
| <!-- Test 8: removing a postscript/prescript. --> | |
| <div id="test8">Test 8: | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math> | |
| </div> | |
| </body> | |
| </html> |