tor-browser

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

superscript.js (22373B)


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