forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts-removeChild.html
More file actions
198 lines (180 loc) · 15.9 KB
/
scripts-removeChild.html
File metadata and controls
198 lines (180 loc) · 15.9 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!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>