subscript.js (21506B)
1 // For documentation of the format, see README in this directory. 2 var browserTests = [ 3 ["foo[]bar", 4 [["subscript",""]], 5 "foo[]bar", 6 [true], 7 {"subscript":[false,false,"",false,true,""]}], 8 // <sub> should be used instead of <span style="text-align: sub"> because 9 // <sub> changes font-size too, thus, they are not equivalent. Additionally, 10 // even if specifying `font-size`, it'd be removed by the other commands. 11 // Therefore, it's hard to maintain <sub> only with CSS. 12 // See also <https://bugzilla.mozilla.org/show_bug.cgi?id=394304#c2>. 13 ["<p>[foo</p> <p>bar]</p>", 14 [["stylewithcss","true"],["subscript",""]], 15 "<p><sub>[foo</sub></p> <p><sub>bar]</sub></p>", 16 [true,true], 17 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 18 ["<p>[foo</p> <p>bar]</p>", 19 [["stylewithcss","false"],["subscript",""]], 20 "<p><sub>[foo</sub></p> <p><sub>bar]</sub></p>", 21 [true,true], 22 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 23 ["<span>[foo</span> <span>bar]</span>", 24 [["stylewithcss","true"],["subscript",""]], 25 "<sub><span>[foo</span> <span>bar]</span></sub>", 26 [true,true], 27 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 28 ["<span>[foo</span> <span>bar]</span>", 29 [["stylewithcss","false"],["subscript",""]], 30 "<sub><span>[foo</span> <span>bar]</span></sub>", 31 [true,true], 32 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 33 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>", 34 [["stylewithcss","true"],["subscript",""]], 35 "<p><sub>[foo</sub></p><p> <sub><span>bar</span></sub> </p><p><sub>baz]</sub></p>", 36 [true,true], 37 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 38 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>", 39 [["stylewithcss","false"],["subscript",""]], 40 "<p><sub>[foo</sub></p><p> <sub><span>bar</span></sub> </p><p><sub>baz]</sub></p>", 41 [true,true], 42 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 43 ["<p>[foo<p><br><p>bar]", 44 [["stylewithcss","true"],["subscript",""]], 45 "<p><sub>[foo</sub></p><p><sub><br></sub></p><p><sub>bar]</sub></p>", 46 [true,true], 47 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 48 ["<p>[foo<p><br><p>bar]", 49 [["stylewithcss","false"],["subscript",""]], 50 "<p><sub>[foo</sub></p><p><sub><br></sub></p><p><sub>bar]</sub></p>", 51 [true,true], 52 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 53 ["<b>foo[]bar</b>", 54 [["subscript",""]], 55 "<b>foo[]bar</b>", 56 [true], 57 {"subscript":[false,false,"",false,true,""]}], 58 ["<i>foo[]bar</i>", 59 [["subscript",""]], 60 "<i>foo[]bar</i>", 61 [true], 62 {"subscript":[false,false,"",false,true,""]}], 63 ["<span>foo</span>{}<span>bar</span>", 64 [["subscript",""]], 65 "<span>foo</span>{}<span>bar</span>", 66 [true], 67 {"subscript":[false,false,"",false,true,""]}], 68 ["<span>foo[</span><span>]bar</span>", 69 [["subscript",""]], 70 "<span>foo[</span><span>]bar</span>", 71 [true], 72 {"subscript":[false,false,"",false,true,""]}], 73 ["foo[bar]baz", 74 [["stylewithcss","true"],["subscript",""]], 75 "foo<sub>[bar]</sub>baz", 76 [true,true], 77 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 78 ["foo[bar]baz", 79 [["stylewithcss","false"],["subscript",""]], 80 "foo<sub>[bar]</sub>baz", 81 [true,true], 82 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 83 ["foo[bar<b>baz]qoz</b>quz", 84 [["stylewithcss","true"],["subscript",""]], 85 "foo<sub>[bar</sub><b><sub>baz]</sub>qoz</b>quz", 86 [true,true], 87 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 88 ["foo[bar<b>baz]qoz</b>quz", 89 [["stylewithcss","false"],["subscript",""]], 90 "foo<sub>[bar</sub><b><sub>baz]</sub>qoz</b>quz", 91 [true,true], 92 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 93 ["foo[bar<i>baz]qoz</i>quz", 94 [["stylewithcss","true"],["subscript",""]], 95 "foo<sub>[bar</sub><i><sub>baz]</sub>qoz</i>quz", 96 [true,true], 97 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 98 ["foo[bar<i>baz]qoz</i>quz", 99 [["stylewithcss","false"],["subscript",""]], 100 "foo<sub>[bar</sub><i><sub>baz]</sub>qoz</i>quz", 101 [true,true], 102 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 103 ["{<p><p> <p>foo</p>}", 104 [["stylewithcss","true"],["subscript",""]], 105 "{<p></p><p> </p><p><sub>foo</sub></p>}", 106 [true,true], 107 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 108 ["{<p><p> <p>foo</p>}", 109 [["stylewithcss","false"],["subscript",""]], 110 "{<p></p><p> </p><p><sub>foo</sub></p>}", 111 [true,true], 112 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 113 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>", 114 [["stylewithcss","true"],["subscript",""]], 115 "<table><tbody><tr><td>foo</td><td>b<sub>[a]</sub>r</td><td>baz</td></tr></tbody></table>", 116 [true,true], 117 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 118 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>", 119 [["stylewithcss","false"],["subscript",""]], 120 "<table><tbody><tr><td>foo</td><td>b<sub>[a]</sub>r</td><td>baz</td></tr></tbody></table>", 121 [true,true], 122 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 123 ["<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>", 124 [["stylewithcss","true"],["subscript",""]], 125 "<table><tbody><tr><td>foo</td>{<td><sub>bar</sub></td>}<td>baz</td></tr></tbody></table>", 126 [true,true], 127 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 128 ["<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>", 129 [["stylewithcss","false"],["subscript",""]], 130 "<table><tbody><tr><td>foo</td>{<td><sub>bar</sub></td>}<td>baz</td></tr></tbody></table>", 131 [true,true], 132 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 133 ["<table><tbody><tr data-start=0 data-end=2><td>foo<td>bar<td>baz</table>", 134 [["stylewithcss","true"],["subscript",""]], 135 "<table><tbody><tr>{<td><sub>foo</sub></td><td><sub>bar</sub></td>}<td>baz</td></tr></tbody></table>", 136 [true,true], 137 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 138 ["<table><tbody><tr data-start=0 data-end=2><td>foo<td>bar<td>baz</table>", 139 [["stylewithcss","false"],["subscript",""]], 140 "<table><tbody><tr>{<td><sub>foo</sub></td><td><sub>bar</sub></td>}<td>baz</td></tr></tbody></table>", 141 [true,true], 142 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 143 ["<table><tbody data-start=0 data-end=1><tr><td>foo<td>bar<td>baz</table>", 144 [["stylewithcss","true"],["subscript",""]], 145 "<table><tbody>{<tr><td><sub>foo</sub></td><td><sub>bar</sub></td><td><sub>baz</sub></td></tr>}</tbody></table>", 146 [true,true], 147 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 148 ["<table><tbody data-start=0 data-end=1><tr><td>foo<td>bar<td>baz</table>", 149 [["stylewithcss","false"],["subscript",""]], 150 "<table><tbody>{<tr><td><sub>foo</sub></td><td><sub>bar</sub></td><td><sub>baz</sub></td></tr>}</tbody></table>", 151 [true,true], 152 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 153 ["<table data-start=0 data-end=1><tbody><tr><td>foo<td>bar<td>baz</table>", 154 [["stylewithcss","true"],["subscript",""]], 155 "<table>{<tbody><tr><td><sub>foo</sub></td><td><sub>bar</sub></td><td><sub>baz</sub></td></tr></tbody>}</table>", 156 [true,true], 157 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 158 ["<table data-start=0 data-end=1><tbody><tr><td>foo<td>bar<td>baz</table>", 159 [["stylewithcss","false"],["subscript",""]], 160 "<table>{<tbody><tr><td><sub>foo</sub></td><td><sub>bar</sub></td><td><sub>baz</sub></td></tr></tbody>}</table>", 161 [true,true], 162 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 163 ["{<table><tr><td>foo<td>bar<td>baz</table>}", 164 [["stylewithcss","true"],["subscript",""]], 165 "{<table><tbody><tr><td><sub>foo</sub></td><td><sub>bar</sub></td><td><sub>baz</sub></td></tr></tbody></table>}", 166 [true,true], 167 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 168 ["{<table><tr><td>foo<td>bar<td>baz</table>}", 169 [["stylewithcss","false"],["subscript",""]], 170 "{<table><tbody><tr><td><sub>foo</sub></td><td><sub>bar</sub></td><td><sub>baz</sub></td></tr></tbody></table>}", 171 [true,true], 172 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 173 ["foo<sub>b[a]r</sub>baz", 174 [["stylewithcss","true"],["subscript",""]], 175 "foo<sub>b</sub>[a]<sub>r</sub>baz", 176 [true,true], 177 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,true,"",false,false,""]}], 178 ["foo<sub>b[a]r</sub>baz", 179 [["stylewithcss","false"],["subscript",""]], 180 "foo<sub>b</sub>[a]<sub>r</sub>baz", 181 [true,true], 182 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,true,"",false,false,""]}], 183 ["foo<sup>[bar]</sup>baz", 184 [["stylewithcss","true"],["subscript",""]], 185 "foo<sub>[bar]</sub>baz", 186 [true,true], 187 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 188 ["foo<sup>[bar]</sup>baz", 189 [["stylewithcss","false"],["subscript",""]], 190 "foo<sub>[bar]</sub>baz", 191 [true,true], 192 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 193 ["foo<sup>b[a]r</sup>baz", 194 [["stylewithcss","true"],["subscript",""]], 195 "foo<sup>b</sup><sub>[a]</sub><sup>r</sup>baz", 196 [true,true], 197 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 198 ["foo<sup>b[a]r</sup>baz", 199 [["stylewithcss","false"],["subscript",""]], 200 "foo<sup>b</sup><sub>[a]</sub><sup>r</sup>baz", 201 [true,true], 202 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 203 // Although <sub> is not equivalent to `vertical-align: sub` as mentioned above, 204 // they are obviously conflict. Therefore, `vertical-align` style of ancestor 205 // and descendants elements of selection should be removed to make <sub> work. 206 ["foo<span style=vertical-align:sub>[bar]</span>baz", 207 [["stylewithcss","true"],["subscript",""]], 208 "foo<sub>[bar]</sub>baz", 209 [true,true], 210 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 211 ["foo<span style=vertical-align:sub>[bar]</span>baz", 212 [["stylewithcss","false"],["subscript",""]], 213 "foo<sub>[bar]</sub>baz", 214 [true,true], 215 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 216 ["foo<span style=vertical-align:super>[bar]</span>baz", 217 [["stylewithcss","true"],["subscript",""]], 218 "foo<sub>[bar]</sub>baz", 219 [true,true], 220 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 221 ["foo<span style=vertical-align:super>[bar]</span>baz", 222 [["stylewithcss","false"],["subscript",""]], 223 "foo<sub>[bar]</sub>baz", 224 [true,true], 225 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 226 ["foo<sub><sub>[bar]</sub></sub>baz", 227 [["stylewithcss","true"],["subscript",""]], 228 "foo[bar]baz", 229 [true,true], 230 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,true,"",false,false,""]}], 231 ["foo<sub><sub>[bar]</sub></sub>baz", 232 [["stylewithcss","false"],["subscript",""]], 233 "foo[bar]baz", 234 [true,true], 235 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,true,"",false,false,""]}], 236 ["foo<sub><sub>b[a]r</sub></sub>baz", 237 [["subscript",""]], 238 "foo<sub>b</sub>[a]<sub>r</sub>baz", 239 [true], 240 {"subscript":[false,true,"",false,false,""]}], 241 ["foo<sub>b<sub>[a]</sub>r</sub>baz", 242 [["subscript",""]], 243 "foo<sub>b</sub>[a]<sub>r</sub>baz", 244 [true], 245 {"subscript":[false,true,"",false,false,""]}], 246 ["foo<sup><sup>[bar]</sup></sup>baz", 247 [["stylewithcss","true"],["subscript",""]], 248 "foo<sub>[bar]</sub>baz", 249 [true,true], 250 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 251 ["foo<sup><sup>[bar]</sup></sup>baz", 252 [["stylewithcss","false"],["subscript",""]], 253 "foo<sub>[bar]</sub>baz", 254 [true,true], 255 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 256 ["foo<sup><sup>b[a]r</sup></sup>baz", 257 [["stylewithcss","true"],["subscript",""]], 258 "foo<sup>b</sup><sub>[a]</sub><sup>r</sup>baz", 259 [true,true], 260 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 261 ["foo<sup><sup>b[a]r</sup></sup>baz", 262 [["stylewithcss","false"],["subscript",""]], 263 "foo<sup>b</sup><sub>[a]</sub><sup>r</sup>baz", 264 [true,true], 265 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 266 ["foo<sup>b<sup>[a]</sup>r</sup>baz", 267 [["stylewithcss","true"],["subscript",""]], 268 "foo<sup>b</sup><sub>[a]</sub><sup>r</sup>baz", 269 [true,true], 270 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 271 ["foo<sup>b<sup>[a]</sup>r</sup>baz", 272 [["stylewithcss","false"],["subscript",""]], 273 "foo<sup>b</sup><sub>[a]</sub><sup>r</sup>baz", 274 [true,true], 275 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 276 ["foo<sub><sup>[bar]</sup></sub>baz", 277 [["stylewithcss","true"],["subscript",""]], 278 "foo<sub>[bar]</sub>baz", 279 [true,true], 280 {"stylewithcss":[false,false,"",false,true,""],"subscript":[true,false,"",false,true,""]}], 281 ["foo<sub><sup>[bar]</sup></sub>baz", 282 [["stylewithcss","false"],["subscript",""]], 283 "foo<sub>[bar]</sub>baz", 284 [true,true], 285 {"stylewithcss":[false,true,"",false,false,""],"subscript":[true,false,"",false,true,""]}], 286 ["foo<sub><sup>b[a]r</sup></sub>baz", 287 [["stylewithcss","true"],["subscript",""]], 288 "foo<sup>b</sup><sub>[a]</sub><sup>r</sup>baz", 289 [true,true], 290 {"stylewithcss":[false,false,"",false,true,""],"subscript":[true,false,"",false,true,""]}], 291 ["foo<sub><sup>b[a]r</sup></sub>baz", 292 [["stylewithcss","false"],["subscript",""]], 293 "foo<sup>b</sup><sub>[a]</sub><sup>r</sup>baz", 294 [true,true], 295 {"stylewithcss":[false,true,"",false,false,""],"subscript":[true,false,"",false,true,""]}], 296 ["foo<sub>b<sup>[a]</sup>r</sub>baz", 297 [["stylewithcss","true"],["subscript",""]], 298 "foo<sub>b[a]r</sub>baz", 299 [true,true], 300 {"stylewithcss":[false,false,"",false,true,""],"subscript":[true,false,"",false,true,""]}], 301 ["foo<sub>b<sup>[a]</sup>r</sub>baz", 302 [["stylewithcss","false"],["subscript",""]], 303 "foo<sub>b[a]r</sub>baz", 304 [true,true], 305 {"stylewithcss":[false,true,"",false,false,""],"subscript":[true,false,"",false,true,""]}], 306 ["foo<sup><sub>[bar]</sub></sup>baz", 307 [["stylewithcss","true"],["subscript",""]], 308 "foo<sub>[bar]</sub>baz", 309 [true,true], 310 {"stylewithcss":[false,false,"",false,true,""],"subscript":[true,false,"",false,true,""]}], 311 ["foo<sup><sub>[bar]</sub></sup>baz", 312 [["stylewithcss","false"],["subscript",""]], 313 "foo<sub>[bar]</sub>baz", 314 [true,true], 315 {"stylewithcss":[false,true,"",false,false,""],"subscript":[true,false,"",false,true,""]}], 316 ["foo<sup><sub>b[a]r</sub></sup>baz", 317 [["stylewithcss","true"],["subscript",""]], 318 "foo<sub>b[a]r</sub>baz", 319 [true,true], 320 {"stylewithcss":[false,false,"",false,true,""],"subscript":[true,false,"",false,true,""]}], 321 ["foo<sup><sub>b[a]r</sub></sup>baz", 322 [["stylewithcss","false"],["subscript",""]], 323 "foo<sub>b[a]r</sub>baz", 324 [true,true], 325 {"stylewithcss":[false,true,"",false,false,""],"subscript":[true,false,"",false,true,""]}], 326 ["foo<sup>b<sub>[a]</sub>r</sup>baz", 327 [["stylewithcss","true"],["subscript",""]], 328 "foo<sup>b</sup><sub>[a]</sub><sup>r</sup>baz", 329 [true,true], 330 {"stylewithcss":[false,false,"",false,true,""],"subscript":[true,false,"",false,true,""]}], 331 ["foo<sup>b<sub>[a]</sub>r</sup>baz", 332 [["stylewithcss","false"],["subscript",""]], 333 "foo<sup>b</sup><sub>[a]</sub><sup>r</sup>baz", 334 [true,true], 335 {"stylewithcss":[false,true,"",false,false,""],"subscript":[true,false,"",false,true,""]}], 336 ["fo[o<sub>b]ar</sub>baz", 337 [["subscript",""]], 338 "fo<sub>[ob]ar</sub>baz", 339 [true], 340 {"subscript":[true,false,"",false,true,""]}], 341 ["foo<sub>ba[r</sub>b]az", 342 [["subscript",""]], 343 "foo<sub>ba[rb]</sub>az", 344 [true], 345 {"subscript":[true,false,"",false,true,""]}], 346 ["fo[o<sub>bar</sub>b]az", 347 [["subscript",""]], 348 "fo<sub>[obarb]</sub>az", 349 [true], 350 {"subscript":[true,false,"",false,true,""]}], 351 ["foo[<sub>b]ar</sub>baz", 352 [["subscript",""]], 353 "foo[b]<sub>ar</sub>baz", 354 [true], 355 {"subscript":[false,true,"",false,false,""]}], 356 ["foo<sub>ba[r</sub>]baz", 357 [["subscript",""]], 358 "foo<sub>ba</sub>[r]baz", 359 [true], 360 {"subscript":[false,true,"",false,false,""]}], 361 ["foo[<sub>bar</sub>]baz", 362 [["stylewithcss","true"],["subscript",""]], 363 "foo[bar]baz", 364 [true,true], 365 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,true,"",false,false,""]}], 366 ["foo[<sub>bar</sub>]baz", 367 [["stylewithcss","false"],["subscript",""]], 368 "foo[bar]baz", 369 [true,true], 370 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,true,"",false,false,""]}], 371 ["foo<sub>[bar]</sub>baz", 372 [["stylewithcss","true"],["subscript",""]], 373 "foo[bar]baz", 374 [true,true], 375 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,true,"",false,false,""]}], 376 ["foo<sub>[bar]</sub>baz", 377 [["stylewithcss","false"],["subscript",""]], 378 "foo[bar]baz", 379 [true,true], 380 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,true,"",false,false,""]}], 381 ["foo{<sub>bar</sub>}baz", 382 [["stylewithcss","true"],["subscript",""]], 383 "foo{bar}baz", 384 [true,true], 385 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,true,"",false,false,""]}], 386 ["foo{<sub>bar</sub>}baz", 387 [["stylewithcss","false"],["subscript",""]], 388 "foo{bar}baz", 389 [true,true], 390 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,true,"",false,false,""]}], 391 // The selected text not in <sub> should be moved into the existing <sub>. 392 ["<sub>fo[o</sub><sup>b]ar</sup>", 393 [["subscript",""]], 394 "<sub>fo[ob]</sub><sup>ar</sup>", 395 [true], 396 {"subscript":[true,false,"",false,true,""]}], 397 // In the following cases, the vertical-align style in the range should be 398 // removed first, then, apply <sub>. 399 ["<sub>fo[o</sub><span style=vertical-align:sub>b]ar</span>", 400 [["stylewithcss","true"],["subscript",""]], 401 "<sub>fo[ob]</sub><span style=\"vertical-align:sub\">ar</span>", 402 [true,true], 403 {"stylewithcss":[false,false,"",false,true,""],"subscript":[true,false,"",false,true,""]}], 404 ["<sub>fo[o</sub><span style=vertical-align:sub>b]ar</span>", 405 [["stylewithcss","false"],["subscript",""]], 406 "<sub>fo[ob]</sub><span style=\"vertical-align:sub\">ar</span>", 407 [true,true], 408 {"stylewithcss":[false,true,"",false,false,""],"subscript":[true,false,"",false,true,""]}], 409 ["<sub>fo[o</sub><span style=vertical-align:top>b]ar</span>", 410 [["stylewithcss","true"],["subscript",""]], 411 "<sub>fo[ob]</sub><span style=\"vertical-align:top\">ar</span>", 412 [true,true], 413 {"stylewithcss":[false,false,"",false,true,""],"subscript":[true,false,"",false,true,""]}], 414 ["<sub>fo[o</sub><span style=vertical-align:top>b]ar</span>", 415 [["stylewithcss","false"],["subscript",""]], 416 "<sub>fo[ob]</sub><span style=\"vertical-align:top\">ar</span>", 417 [true,true], 418 {"stylewithcss":[false,true,"",false,false,""],"subscript":[true,false,"",false,true,""]}], 419 // Even if a vertical-align value is not related to <sub>/<sup>, it should be 420 // removed to make new <sub> work cleanly. 421 ["foo<span style=vertical-align:top>[bar]</span>baz", 422 [["stylewithcss","true"],["subscript",""]], 423 "foo<sub>[bar]</sub>baz", 424 [true,true], 425 {"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}], 426 ["foo<span style=vertical-align:top>[bar]</span>baz", 427 [["stylewithcss","false"],["subscript",""]], 428 "foo<sub>[bar]</sub>baz", 429 [true,true], 430 {"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}], 431 432 // Should not change the style of the non-editable nodes so that only the 433 // visible and editable nodes are wrapped into the <sub> elements. 434 ['{ <span contenteditable="false">A</span> ; <span contenteditable="false">B</span> ; <span contenteditable="false">C</span> }', 435 [["stylewithcss","false"],["subscript",""]], 436 ' <span contenteditable="false">A</span><sub> ; </sub><span contenteditable="false">B</span><sub> ; </sub><span contenteditable="false">C</span> ', 437 [true,true], 438 {}], 439 ]