tor-browser

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

inserttext.js (61019B)


      1 // For documentation of the format, see README in this directory.
      2 var browserTests = [
      3 ["foo[bar]baz",
      4    [["inserttext","a"]],
      5    "fooa[]baz",
      6    [true],
      7    {"inserttext":[false,false,"",false,false,""]}],
      8 ["foo[bar]baz",
      9    [["inserttext",""]],
     10    "foo[]baz",
     11    [true],
     12    {"inserttext":[false,false,"",false,false,""]}],
     13 ["foo[]bar",
     14    [["inserttext","\t"]],
     15    "foo\t[]bar",
     16    [true],
     17    {"inserttext":[false,false,"",false,false,""]}],
     18 ["foo[]bar",
     19    [["inserttext","&"]],
     20    "foo&[]bar",
     21    [true],
     22    {"inserttext":[false,false,"",false,false,""]}],
     23 ["foo[]bar",
     24    [["defaultparagraphseparator","div"],["inserttext","\n"]],
     25    "<div>foo</div><div>{}bar</div>",
     26    [true,true],
     27    {"defaultparagraphseparator":[false,false,"div",false,false,"div"],"inserttext":[false,false,"",false,false,""]}],
     28 ["foo[]bar",
     29    [["defaultparagraphseparator","p"],["inserttext","\n"]],
     30    "<p>foo</p><p>{}bar</p>",
     31    [true,true],
     32    {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserttext":[false,false,"",false,false,""]}],
     33 ["foo[]bar",
     34    [["defaultparagraphseparator","div"],["inserttext","abc\ndef"]],
     35    "<div>fooabc</div><div>def[]bar</div>",
     36    [true,true],
     37    {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserttext":[false,false,"",false,false,""]}],
     38 ["foo[]bar",
     39    [["defaultparagraphseparator","p"],["inserttext","abc\ndef"]],
     40    "<p>fooabc</p><p>def[]bar</p>",
     41    [true,true],
     42    {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserttext":[false,false,"",false,false,""]}],
     43 ["foo[]bar",
     44    [["inserttext","\u0007"]],
     45    "foo\u0007[]bar",
     46    [true],
     47    {"inserttext":[false,false,"",false,false,""]}],
     48 ["foo[]bar",
     49    [["inserttext","<b>hi</b>"]],
     50    "foo&lt;b&gt;hi&lt;/b&gt;[]bar",
     51    [true],
     52    {"inserttext":[false,false,"",false,false,""]}],
     53 ["foo[]bar",
     54    [["inserttext","<"]],
     55    "foo&lt;[]bar",
     56    [true],
     57    {"inserttext":[false,false,"",false,false,""]}],
     58 ["foo[]bar",
     59    [["inserttext","&amp;"]],
     60    "foo&amp;amp;[]bar",
     61    [true],
     62    {"inserttext":[false,false,"",false,false,""]}],
     63 ["foo[]bar",
     64    [["inserttext"," "]],
     65    "foo []bar",
     66    [true],
     67    {"inserttext":[false,false,"",false,false,""]}],
     68 ["foo []bar",
     69    [["inserttext"," "]],
     70    ["foo&nbsp; bar", "foo &nbsp;bar"],
     71    [true],
     72    {"inserttext":[false,false,"",false,false,""]}],
     73 ["foo[] bar",
     74    [["inserttext"," "]],
     75    ["foo&nbsp; bar", "foo &nbsp;bar"],
     76    [true],
     77    {"inserttext":[false,false,"",false,false,""]}],
     78 ["foo &nbsp;[]bar",
     79    [["inserttext"," "]],
     80    ["foo &nbsp; bar", "foo&nbsp; &nbsp;bar"],
     81    [true],
     82    {"inserttext":[false,false,"",false,false,""]}],
     83 ["foo []&nbsp;bar",
     84    [["inserttext"," "]],
     85    ["foo &nbsp; bar", "foo&nbsp; &nbsp;bar"],
     86    [true],
     87    {"inserttext":[false,false,"",false,false,""]}],
     88 ["foo[] &nbsp;bar",
     89    [["inserttext"," "]],
     90    ["foo &nbsp; bar", "foo&nbsp; &nbsp;bar"],
     91    [true],
     92    {"inserttext":[false,false,"",false,false,""]}],
     93 ["foo&nbsp; []bar",
     94    [["inserttext"," "]],
     95    ["foo &nbsp; bar", "foo&nbsp; &nbsp;bar"],
     96    [true],
     97    {"inserttext":[false,false,"",false,false,""]}],
     98 ["foo&nbsp;[] bar",
     99    [["inserttext"," "]],
    100    ["foo &nbsp; bar", "foo&nbsp; &nbsp;bar"],
    101    [true],
    102    {"inserttext":[false,false,"",false,false,""]}],
    103 ["foo[]&nbsp; bar",
    104    [["inserttext"," "]],
    105    ["foo &nbsp; bar", "foo&nbsp; &nbsp;bar"],
    106    [true],
    107    {"inserttext":[false,false,"",false,false,""]}],
    108 ["foo&nbsp;&nbsp;[]bar",
    109    [["inserttext"," "]],
    110    ["foo &nbsp; bar", "foo&nbsp; &nbsp;bar"],
    111    [true],
    112    {"inserttext":[false,false,"",false,false,""]}],
    113 ["foo&nbsp;[]&nbsp;bar",
    114    [["inserttext"," "]],
    115    ["foo &nbsp; bar", "foo&nbsp; &nbsp;bar"],
    116    [true],
    117    {"inserttext":[false,false,"",false,false,""]}],
    118 ["foo[]&nbsp;&nbsp;bar",
    119    [["inserttext"," "]],
    120    ["foo &nbsp; bar", "foo&nbsp; &nbsp;bar"],
    121    [true],
    122    {"inserttext":[false,false,"",false,false,""]}],
    123 ["foo []&nbsp;        bar",
    124    [["inserttext"," "]],
    125    ["foo&nbsp; &nbsp; bar", "foo &nbsp; &nbsp;bar"],
    126    [true],
    127    {"inserttext":[false,false,"",false,false,""]}],
    128 ["foo  []bar",
    129    [["inserttext"," "]],
    130    ["foo&nbsp; bar", "foo &nbsp;bar"],
    131    [true],
    132    {"inserttext":[false,false,"",false,false,""]}],
    133 ["foo []&nbsp;&nbsp; &nbsp; bar",
    134    [["inserttext"," "]],
    135    ["foo &nbsp; &nbsp; &nbsp; bar", "foo&nbsp; &nbsp; &nbsp; &nbsp;bar"],
    136    [true],
    137    {"inserttext":[false,false,"",false,false,""]}],
    138 ["[]foo",
    139    [["inserttext"," "]],
    140    "&nbsp;foo",
    141    [true],
    142    {"inserttext":[false,false,"",false,false,""]}],
    143 ["{}foo",
    144    [["inserttext"," "]],
    145    "&nbsp;foo",
    146    [true],
    147    {"inserttext":[false,false,"",false,false,""]}],
    148 ["foo[]",
    149    [["inserttext"," "]],
    150    "foo&nbsp;",
    151    [true],
    152    {"inserttext":[false,false,"",false,false,""]}],
    153 ["foo{}",
    154    [["inserttext"," "]],
    155    "foo&nbsp;",
    156    [true],
    157    {"inserttext":[false,false,"",false,false,""]}],
    158 ["foo&nbsp;[]",
    159    [["inserttext"," "]],
    160    ["foo &nbsp;", "foo&nbsp;&nbsp;"],
    161    [true],
    162    {"inserttext":[false,false,"",false,false,""]}],
    163 ["foo&nbsp;{}",
    164    [["inserttext"," "]],
    165    ["foo &nbsp;", "foo&nbsp;&nbsp;"],
    166    [true],
    167    {"inserttext":[false,false,"",false,false,""]}],
    168 ["foo&nbsp;&nbsp;[]",
    169    [["inserttext"," "]],
    170    ["foo &nbsp;&nbsp;", "foo&nbsp; &nbsp;"],
    171    [true],
    172    {"inserttext":[false,false,"",false,false,""]}],
    173 ["foo&nbsp;&nbsp;{}",
    174    [["inserttext"," "]],
    175    ["foo &nbsp;&nbsp;", "foo&nbsp; &nbsp;"],
    176    [true],
    177    {"inserttext":[false,false,"",false,false,""]}],
    178 ["<b>foo[]</b>bar",
    179    [["inserttext"," "]],
    180    // It's fine to convert the last white-space of the Text to an NBSP for
    181    // optimizing the deletion handling of the following "bar".
    182    ["<b>foo </b>bar", "<b>foo&nbsp;</b>bar"],
    183    [true],
    184    {"inserttext":[false,false,"",false,false,""]}],
    185 ["foo[]<b>bar</b>",
    186    [["inserttext"," "]],
    187    // It's fine to convert the last white-space of the Text to an NBSP for
    188    // optimizing the deletion handling of the following <b>.
    189    ["foo <b>bar</b>", "foo&nbsp;<b>bar</b>"],
    190    [true],
    191    {"inserttext":[false,false,"",false,false,""]}],
    192 ["foo[] ",
    193    [["inserttext"," "]],
    194    "foo&nbsp;",
    195    [true],
    196    {"inserttext":[false,false,"",false,false,""]}],
    197 [" foo   []   ",
    198    [["inserttext"," "]],
    199    " foo&nbsp;",
    200    [true],
    201    {"inserttext":[false,false,"",false,false,""]}],
    202 ["foo[]<span> </span>",
    203    [["inserttext"," "]],
    204    // It's fine to delete the following invisible white-spaces.
    205    ["foo&nbsp;<span> </span>", "foo&nbsp;<span></span>", "foo&nbsp;"],
    206    [true],
    207    {"inserttext":[false,false,"",false,false,""]}],
    208 ["foo[]<span> </span> ",
    209    [["inserttext"," "]],
    210    // It's fine to delete the following invisible white-spaces.
    211    ["foo&nbsp;[]<span> </span> ", "foo&nbsp;<span></span>", "foo&nbsp;"],
    212    [true],
    213    {"inserttext":[false,false,"",false,false,""]}],
    214 [" []foo",
    215    [["inserttext"," "]],
    216    "&nbsp;foo",
    217    [true],
    218    {"inserttext":[false,false,"",false,false,""]}],
    219 ["   []   foo ",
    220    [["inserttext"," "]],
    221    "&nbsp;foo ",
    222    [true],
    223    {"inserttext":[false,false,"",false,false,""]}],
    224 ["<span> </span>[]foo",
    225    [["inserttext"," "]],
    226    // It's fine to delete the preceding white-space
    227    ["<span> </span>&nbsp;foo", "<span></span>&nbsp;foo", "&nbsp;foo"],
    228    [true],
    229    {"inserttext":[false,false,"",false,false,""]}],
    230 [" <span> </span>[]foo",
    231    [["inserttext"," "]],
    232    // It's fine to delete the preceding white-space
    233    [" <span> </span>&nbsp;foo", "<span></span>&nbsp;foo", "&nbsp;foo"],
    234    [true],
    235    {"inserttext":[false,false,"",false,false,""]}],
    236 ["{}<br>",
    237    [["inserttext"," "]],
    238    "&nbsp;",
    239    [true],
    240    {"inserttext":[false,false,"",false,false,""]}],
    241 ["<p>{}<br>",
    242    [["inserttext"," "]],
    243    "<p>&nbsp;</p>",
    244    [true],
    245    {"inserttext":[false,false,"",false,false,""]}],
    246 ["<p>foo[]<p>bar",
    247    [["inserttext"," "]],
    248    "<p>foo&nbsp;</p><p>bar</p>",
    249    [true],
    250    {"inserttext":[false,false,"",false,false,""]}],
    251 ["<p>foo&nbsp;[]<p>bar",
    252    [["inserttext"," "]],
    253    ["<p>foo &nbsp;</p><p>bar</p>", "<p>foo&nbsp;&nbsp;</p><p>bar</p>"],
    254    [true],
    255    {"inserttext":[false,false,"",false,false,""]}],
    256 ["<p>foo[]<p>&nbsp;bar",
    257    [["inserttext"," "]],
    258    "<p>foo&nbsp;</p><p>&nbsp;bar</p>",
    259    [true],
    260    {"inserttext":[false,false,"",false,false,""]}],
    261 ["<pre>foo[]bar</pre>",
    262    [["inserttext"," "]],
    263    "<pre>foo bar</pre>",
    264    [true],
    265    {"inserttext":[false,false,"",false,false,""]}],
    266 ["<pre>foo []bar</pre>",
    267    [["inserttext"," "]],
    268    "<pre>foo  bar</pre>",
    269    [true],
    270    {"inserttext":[false,false,"",false,false,""]}],
    271 ["<pre>foo[] bar</pre>",
    272    [["inserttext"," "]],
    273    "<pre>foo  bar</pre>",
    274    [true],
    275    {"inserttext":[false,false,"",false,false,""]}],
    276 ["<pre>foo &nbsp;[]bar</pre>",
    277    [["inserttext"," "]],
    278    "<pre>foo &nbsp; bar</pre>",
    279    [true],
    280    {"inserttext":[false,false,"",false,false,""]}],
    281 ["<pre>[]foo</pre>",
    282    [["inserttext"," "]],
    283    "<pre> foo</pre>",
    284    [true],
    285    {"inserttext":[false,false,"",false,false,""]}],
    286 ["<pre>foo[]</pre>",
    287    [["inserttext"," "]],
    288    "<pre>foo </pre>",
    289    [true],
    290    {"inserttext":[false,false,"",false,false,""]}],
    291 ["<pre>foo&nbsp;[]</pre>",
    292    [["inserttext"," "]],
    293    "<pre>foo&nbsp; </pre>",
    294    [true],
    295    {"inserttext":[false,false,"",false,false,""]}],
    296 ["<pre> foo   []   </pre>",
    297    [["inserttext"," "]],
    298    "<pre> foo       </pre>",
    299    [true],
    300    {"inserttext":[false,false,"",false,false,""]}],
    301 ["<div style=white-space:pre>foo[]bar</div>",
    302    [["inserttext"," "]],
    303    "<div style=\"white-space:pre\">foo bar</div>",
    304    [true],
    305    {"inserttext":[false,false,"",false,false,""]}],
    306 ["<div style=white-space:pre>foo []bar</div>",
    307    [["inserttext"," "]],
    308    "<div style=\"white-space:pre\">foo  bar</div>",
    309    [true],
    310    {"inserttext":[false,false,"",false,false,""]}],
    311 ["<div style=white-space:pre>foo[] bar</div>",
    312    [["inserttext"," "]],
    313    "<div style=\"white-space:pre\">foo  bar</div>",
    314    [true],
    315    {"inserttext":[false,false,"",false,false,""]}],
    316 ["<div style=white-space:pre>foo &nbsp;[]bar</div>",
    317    [["inserttext"," "]],
    318    ["<div style=\"white-space:pre\">foo &nbsp; bar</div>",
    319     "<div style=\"white-space:pre\">foo&nbsp; &nbsp;bar</div>"],
    320    [true],
    321    {"inserttext":[false,false,"",false,false,""]}],
    322 ["<div style=white-space:pre>[]foo</div>",
    323    [["inserttext"," "]],
    324    "<div style=\"white-space:pre\"> foo</div>",
    325    [true],
    326    {"inserttext":[false,false,"",false,false,""]}],
    327 ["<div style=white-space:pre>foo[]</div>",
    328    [["inserttext"," "]],
    329    "<div style=\"white-space:pre\">foo </div>",
    330    [true],
    331    {"inserttext":[false,false,"",false,false,""]}],
    332 ["<div style=white-space:pre>foo&nbsp;[]</div>",
    333    [["inserttext"," "]],
    334    "<div style=\"white-space:pre\">foo&nbsp; </div>",
    335    [true],
    336    {"inserttext":[false,false,"",false,false,""]}],
    337 ["<div style=white-space:pre> foo   []   </div>",
    338    [["inserttext"," "]],
    339    "<div style=\"white-space:pre\"> foo       </div>",
    340    [true],
    341    {"inserttext":[false,false,"",false,false,""]}],
    342 ["<div style=white-space:pre-wrap>foo[]bar</div>",
    343    [["inserttext"," "]],
    344    "<div style=\"white-space:pre-wrap\">foo bar</div>",
    345    [true],
    346    {"inserttext":[false,false,"",false,false,""]}],
    347 ["<div style=white-space:pre-wrap>foo []bar</div>",
    348    [["inserttext"," "]],
    349    "<div style=\"white-space:pre-wrap\">foo  bar</div>",
    350    [true],
    351    {"inserttext":[false,false,"",false,false,""]}],
    352 ["<div style=white-space:pre-wrap>foo[] bar</div>",
    353    [["inserttext"," "]],
    354    "<div style=\"white-space:pre-wrap\">foo [] bar</div>",
    355    [true],
    356    {"inserttext":[false,false,"",false,false,""]}],
    357 ["<div style=white-space:pre-wrap>foo &nbsp;[]bar</div>",
    358    [["inserttext"," "]],
    359    "<div style=\"white-space:pre-wrap\">foo &nbsp; bar</div>",
    360    [true],
    361    {"inserttext":[false,false,"",false,false,""]}],
    362 ["<div style=white-space:pre-wrap>[]foo</div>",
    363    [["inserttext"," "]],
    364    "<div style=\"white-space:pre-wrap\"> []foo</div>",
    365    [true],
    366    {"inserttext":[false,false,"",false,false,""]}],
    367 ["<div style=white-space:pre-wrap>foo[]</div>",
    368    [["inserttext"," "]],
    369    "<div style=\"white-space:pre-wrap\">foo </div>",
    370    [true],
    371    {"inserttext":[false,false,"",false,false,""]}],
    372 ["<div style=white-space:pre-wrap>foo&nbsp;[]</div>",
    373    [["inserttext"," "]],
    374    "<div style=\"white-space:pre-wrap\">foo&nbsp; []</div>",
    375    [true],
    376    {"inserttext":[false,false,"",false,false,""]}],
    377 ["<div style=white-space:pre-wrap> foo   []   </div>",
    378    [["inserttext"," "]],
    379    "<div style=\"white-space:pre-wrap\"> foo       </div>",
    380    [true],
    381    {"inserttext":[false,false,"",false,false,""]}],
    382 ["<div style=white-space:pre-line>foo[]bar</div>",
    383    [["inserttext"," "]],
    384    "<div style=\"white-space:pre-line\">foo bar</div>",
    385    [true],
    386    {"inserttext":[false,false,"",false,false,""]}],
    387 ["<div style=white-space:pre-line>foo []bar</div>",
    388    [["inserttext"," "]],
    389    ["<div style=\"white-space:pre-line\">foo&nbsp; bar</div>",
    390     "<div style=\"white-space:pre-line\">foo &nbsp;bar</div>"],
    391    [true],
    392    {"inserttext":[false,false,"",false,false,""]}],
    393 ["<div style=white-space:pre-line>foo[] bar</div>",
    394    [["inserttext"," "]],
    395    ["<div style=\"white-space:pre-line\">foo&nbsp; bar</div>",
    396     "<div style=\"white-space:pre-line\">foo &nbsp;bar</div>"],
    397    [true],
    398    {"inserttext":[false,false,"",false,false,""]}],
    399 ["<div style=white-space:pre-line>foo &nbsp;[]bar</div>",
    400    [["inserttext"," "]],
    401    ["<div style=\"white-space:pre-line\">foo &nbsp; bar</div>",
    402     "<div style=\"white-space:pre-line\">foo&nbsp; &nbsp;bar</div>"],
    403    [true],
    404    {"inserttext":[false,false,"",false,false,""]}],
    405 ["<div style=white-space:pre-line>[]foo</div>",
    406    [["inserttext"," "]],
    407    "<div style=\"white-space:pre-line\">&nbsp;foo</div>",
    408    [true],
    409    {"inserttext":[false,false,"",false,false,""]}],
    410 ["<div style=white-space:pre-line>foo[]</div>",
    411    [["inserttext"," "]],
    412    "<div style=\"white-space:pre-line\">foo&nbsp;</div>",
    413    [true],
    414    {"inserttext":[false,false,"",false,false,""]}],
    415 ["<div style=white-space:pre-line>foo&nbsp;[]</div>",
    416    [["inserttext"," "]],
    417    ["<div style=\"white-space:pre-line\">foo &nbsp;</div>",
    418     "<div style=\"white-space:pre-line\">foo&nbsp;&nbsp;</div>"],
    419    [true],
    420    {"inserttext":[false,false,"",false,false,""]}],
    421 ["<div style=white-space:pre-line> foo   []   </div>",
    422    [["inserttext"," "]],
    423    "<div style=\"white-space:pre-line\"> foo&nbsp;</div>",
    424    [true],
    425    {"inserttext":[false,false,"",false,false,""]}],
    426 ["<div style=white-space:nowrap>foo[]bar</div>",
    427    [["inserttext"," "]],
    428    "<div style=\"white-space:nowrap\">foo bar</div>",
    429    [true],
    430    {"inserttext":[false,false,"",false,false,""]}],
    431 ["<div style=white-space:nowrap>foo []bar</div>",
    432    [["inserttext"," "]],
    433    ["<div style=\"white-space:nowrap\">foo&nbsp; bar</div>",
    434     "<div style=\"white-space:nowrap\">foo &nbsp;bar</div>"],
    435    [true],
    436    {"inserttext":[false,false,"",false,false,""]}],
    437 ["<div style=white-space:nowrap>foo[] bar</div>",
    438    [["inserttext"," "]],
    439    ["<div style=\"white-space:nowrap\">foo&nbsp; bar</div>",
    440     "<div style=\"white-space:nowrap\">foo &nbsp;bar</div>"],
    441    [true],
    442    {"inserttext":[false,false,"",false,false,""]}],
    443 ["<div style=white-space:nowrap>foo &nbsp;[]bar</div>",
    444    [["inserttext"," "]],
    445    ["<div style=\"white-space:nowrap\">foo &nbsp; bar</div>",
    446     "<div style=\"white-space:nowrap\">foo&nbsp; &nbsp;bar</div>"],
    447    [true],
    448    {"inserttext":[false,false,"",false,false,""]}],
    449 ["<div style=white-space:nowrap>[]foo</div>",
    450    [["inserttext"," "]],
    451    "<div style=\"white-space:nowrap\">&nbsp;foo</div>",
    452    [true],
    453    {"inserttext":[false,false,"",false,false,""]}],
    454 ["<div style=white-space:nowrap>foo[]</div>",
    455    [["inserttext"," "]],
    456    "<div style=\"white-space:nowrap\">foo&nbsp;</div>",
    457    [true],
    458    {"inserttext":[false,false,"",false,false,""]}],
    459 ["<div style=white-space:nowrap>foo&nbsp;[]</div>",
    460    [["inserttext"," "]],
    461    "<div style=\"white-space:nowrap\">foo &nbsp;</div>",
    462    [true],
    463    {"inserttext":[false,false,"",false,false,""]}],
    464 ["<div style=white-space:nowrap> foo   []   </div>",
    465    [["inserttext"," "]],
    466    "<div style=\"white-space:nowrap\"> foo&nbsp;</div>",
    467    [true],
    468    {"inserttext":[false,false,"",false,false,""]}],
    469 ["http://a[]",
    470    [["inserttext"," "]],
    471    "http://a&nbsp;",
    472    [true],
    473    {"inserttext":[false,false,"",false,false,""]}],
    474 ["ftp://a[]",
    475    [["inserttext"," "]],
    476    "ftp://a&nbsp;",
    477    [true],
    478    {"inserttext":[false,false,"",false,false,""]}],
    479 ["quasit://a[]",
    480    [["inserttext"," "]],
    481    "quasit://a&nbsp;",
    482    [true],
    483    {"inserttext":[false,false,"",false,false,""]}],
    484 [".x-++-.://a[]",
    485    [["inserttext"," "]],
    486    ".x-++-.://a&nbsp;",
    487    [true],
    488    {"inserttext":[false,false,"",false,false,""]}],
    489 ["(http://a)[]",
    490    [["inserttext"," "]],
    491    "(http://a)&nbsp;",
    492    [true],
    493    {"inserttext":[false,false,"",false,false,""]}],
    494 ["&lt;http://a>[]",
    495    [["inserttext"," "]],
    496    "&lt;http://a&gt;&nbsp;",
    497    [true],
    498    {"inserttext":[false,false,"",false,false,""]}],
    499 ["http://a![]",
    500    [["inserttext"," "]],
    501    "http://a!&nbsp;",
    502    [true],
    503    {"inserttext":[false,false,"",false,false,""]}],
    504 ["!\"#$%&amp;'()*+,-./:;&lt;=>?^_`|~http://a!\"#$%&amp;'()*+,-./:;&lt;=>?^_`|~[]",
    505    [["inserttext"," "]],
    506    "!\"#$%&amp;'()*+,-./:;&lt;=&gt;?^_`|~http://a!\"#$%&amp;'()*+,-./:;&lt;=&gt;?^_`|~&nbsp;",
    507    [true],
    508    {"inserttext":[false,false,"",false,false,""]}],
    509 ["http://a!\"'(),-.:;&lt;>`[]",
    510    [["inserttext"," "]],
    511    "http://a!\"'(),-.:;&lt;&gt;`&nbsp;",
    512    [true],
    513    {"inserttext":[false,false,"",false,false,""]}],
    514 ["http://a#$%&amp;*+/=?^_|~[]",
    515    [["inserttext"," "]],
    516    "http://a#$%&amp;*+/=?^_|~&nbsp;",
    517    [true],
    518    {"inserttext":[false,false,"",false,false,""]}],
    519 ["mailto:a[]",
    520    [["inserttext"," "]],
    521    "mailto:a&nbsp;",
    522    [true],
    523    {"inserttext":[false,false,"",false,false,""]}],
    524 ["a@b[]",
    525    [["inserttext"," "]],
    526    "a@b&nbsp;",
    527    [true],
    528    {"inserttext":[false,false,"",false,false,""]}],
    529 ["a@[]",
    530    [["inserttext"," "]],
    531    "a@&nbsp;",
    532    [true],
    533    {"inserttext":[false,false,"",false,false,""]}],
    534 ["@b[]",
    535    [["inserttext"," "]],
    536    "@b&nbsp;",
    537    [true],
    538    {"inserttext":[false,false,"",false,false,""]}],
    539 ["#@x[]",
    540    [["inserttext"," "]],
    541    "#@x&nbsp;",
    542    [true],
    543    {"inserttext":[false,false,"",false,false,""]}],
    544 ["a@.[]",
    545    [["inserttext"," "]],
    546    "a@.&nbsp;",
    547    [true],
    548    {"inserttext":[false,false,"",false,false,""]}],
    549 ["!\"#$%&amp;'()*+,-./:;&lt;=>?^_`|~a@b!\"#$%&amp;'()*+,-./:;&lt;=>?^_`|~[]",
    550    [["inserttext"," "]],
    551    "!\"#$%&amp;'()*+,-./:;&lt;=&gt;?^_`|~a@b!\"#$%&amp;'()*+,-./:;&lt;=&gt;?^_`|~&nbsp;",
    552    [true],
    553    {"inserttext":[false,false,"",false,false,""]}],
    554 ["<b>a@b</b>{}",
    555    [["inserttext"," "]],
    556    "<b>a@b</b>&nbsp;",
    557    [true],
    558    {"inserttext":[false,false,"",false,false,""]}],
    559 ["<b>a</b><i>@</i><u>b</u>{}",
    560    [["inserttext"," "]],
    561    "<b>a</b><i>@</i><u>b</u>&nbsp;",
    562    [true],
    563    {"inserttext":[false,false,"",false,false,""]}],
    564 ["a@b<b>[]c</b>",
    565    [["inserttext"," "]],
    566    "a@b<b>&nbsp;c</b>",
    567    [true],
    568    {"inserttext":[false,false,"",false,false,""]}],
    569 ["<p>a@b</p><p>[]c</p>",
    570    [["inserttext"," "]],
    571    "<p>a@b</p><p>&nbsp;c</p>",
    572    [true],
    573    {"inserttext":[false,false,"",false,false,""]}],
    574 ["http://a[]",
    575    [["inserttext","a"]],
    576    "http://aa[]",
    577    [true],
    578    {"inserttext":[false,false,"",false,false,""]}],
    579 ["http://a[]",
    580    [["inserttext","\t"]],
    581    // XXX Do web developers want to insert a horizontal-tab as-is?
    582    "http://a\t",
    583    [true],
    584    {"inserttext":[false,false,"",false,false,""]}],
    585 ["http://a[]",
    586    [["inserttext","\f"]],
    587    // XXX Do web developers want to insert a formfeed as-is?
    588    "http://a\f",
    589    [true],
    590    {"inserttext":[false,false,"",false,false,""]}],
    591 ["http://a[]",
    592    [["inserttext","\u00A0"]],
    593    "http://a&nbsp;[]",
    594    [true],
    595    {"inserttext":[false,false,"",false,false,""]}],
    596 ["foo[]",
    597    [["inserttext","   "]],
    598    ["foo &nbsp;&nbsp;", "foo&nbsp; &nbsp;"],
    599    [true],
    600    {"inserttext":[false,false,"",false,false,""]}],
    601 ["foo[]bar",
    602    [["inserttext","a"]],
    603    "fooa[]bar",
    604    [true],
    605    {"inserttext":[false,false,"",false,false,""]}],
    606 ["foo&nbsp;[]",
    607    [["inserttext","a"]],
    608    "foo a[]",
    609    [true],
    610    {"inserttext":[false,false,"",false,false,""]}],
    611 ["foo\u00A0[]",
    612    [["inserttext","a"]],
    613    "foo a[]",
    614    [true],
    615    {"inserttext":[false,false,"",false,false,""]}],
    616 ["<p>foo[]",
    617    [["inserttext","a"]],
    618    "<p>fooa[]</p>",
    619    [true],
    620    {"inserttext":[false,false,"",false,false,""]}],
    621 ["<p>foo</p>{}",
    622    [["inserttext","a"]],
    623    "<p>foo</p>a[]",
    624    [true],
    625    {"inserttext":[false,false,"",false,false,""]}],
    626 ["<p>[]foo",
    627    [["inserttext","a"]],
    628    "<p>a[]foo</p>",
    629    [true],
    630    {"inserttext":[false,false,"",false,false,""]}],
    631 ["<p>{}foo",
    632    [["inserttext","a"]],
    633    "<p>a[]foo</p>",
    634    [true],
    635    {"inserttext":[false,false,"",false,false,""]}],
    636 ["{}<p>foo",
    637    [["inserttext","a"]],
    638    // XXX The users probably cannot put caret before the first paragraph
    639    // with operations. So, only web developers can put caret to there only
    640    // with using Selection API.  Then, is this what the web developers actually
    641    // want?
    642    "a<p>foo</p>",
    643    [true],
    644    {"inserttext":[false,false,"",false,false,""]}],
    645 ["<p>foo</p>{}<p>bar</p>",
    646    [["inserttext","a"]],
    647    // XXX The users probably cannot put caret between paragraphs with
    648    // operations. So, only web developers can put caret to there only with
    649    // using Selection API.  Then, is this what the web developers actually
    650    // want?
    651    "<p>foo</p>a[]<p>bar</p>",
    652    [true],
    653    {"inserttext":[false,false,"",false,false,""]}],
    654 ["<b>foo[]</b>bar",
    655    [["inserttext","a"]],
    656    "<b>fooa[]</b>bar",
    657    [true],
    658    {"inserttext":[false,false,"",false,false,""]}],
    659 ["<b>foo</b>[]bar",
    660    [["inserttext","a"]],
    661    "<b>foo</b>a[]bar",
    662    [true],
    663    {"inserttext":[false,false,"",false,false,""]}],
    664 ["foo<b>{}</b>bar",
    665    [["inserttext","a"]],
    666    "foo<b>a[]</b>bar",
    667    [true],
    668    {"inserttext":[false,false,"",false,false,""]}],
    669 ["<a>foo[]</a>bar",
    670    [["inserttext","a"]],
    671    "<a>fooa[]</a>bar",
    672    [true],
    673    {"inserttext":[false,false,"",false,false,""]}],
    674 ["<a>foo</a>[]bar",
    675    [["inserttext","a"]],
    676    "<a>foo</a>a[]bar",
    677    [true],
    678    {"inserttext":[false,false,"",false,false,""]}],
    679 ["<a href=/>foo[]</a>bar",
    680    [["inserttext","a"]],
    681    "<a href=\"/\">fooa[]</a>bar",
    682    [true],
    683    {"inserttext":[false,false,"",false,false,""]}],
    684 ["<a href=/>foo</a>[]bar",
    685    [["inserttext","a"]],
    686    "<a href=\"/\">foo</a>a[]bar",
    687    [true],
    688    {"inserttext":[false,false,"",false,false,""]}],
    689 ["<p>fo[o<p>b]ar",
    690    [["defaultparagraphseparator","div"],["inserttext","a"]],
    691    "<p>foa[]ar</p>",
    692    [true,true],
    693    {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserttext":[false,false,"",false,false,""]}],
    694 ["<p>fo[o<p>b]ar",
    695    [["defaultparagraphseparator","p"],["inserttext","a"]],
    696    "<p>foa[]ar</p>",
    697    [true,true],
    698    {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserttext":[false,false,"",false,false,""]}],
    699 ["<p>fo[o<p>bar<p>b]az",
    700    [["defaultparagraphseparator","div"],["inserttext","a"]],
    701    "<p>foa[]az</p>",
    702    [true,true],
    703    {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserttext":[false,false,"",false,false,""]}],
    704 ["<p>fo[o<p>bar<p>b]az",
    705    [["defaultparagraphseparator","p"],["inserttext","a"]],
    706    "<p>foa[]az</p>",
    707    [true,true],
    708    {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserttext":[false,false,"",false,false,""]}],
    709 ["{}<br>",
    710    [["inserttext","a"]],
    711    "a[]",
    712    [true],
    713    {"inserttext":[false,false,"",false,false,""]}],
    714 ["<p>{}<br>",
    715    [["inserttext","a"]],
    716    "<p>a[]</p>",
    717    [true],
    718    {"inserttext":[false,false,"",false,false,""]}],
    719 ["<p><span>{}<br></span>",
    720    [["inserttext","a"]],
    721    "<p><span>a[]</span></p>",
    722    [true],
    723    {"inserttext":[false,false,"",false,false,""]}],
    724 ["<p>foo<span style=color:#aBcDeF>[bar]</span>baz",
    725    [["inserttext","a"]],
    726    "<p>foo<span style=\"color:rgb(171, 205, 239)\">a[]</span>baz</p>",
    727    [true],
    728    {"inserttext":[false,false,"",false,false,""]}],
    729 ["<p>foo<span style=color:#aBcDeF>{bar}</span>baz",
    730    [["inserttext","a"]],
    731    "<p>foo<span style=\"color:rgb(171, 205, 239)\">a[]</span>baz</p>",
    732    [true],
    733    {"inserttext":[false,false,"",false,false,""]}],
    734 ["<p>foo{<span style=color:#aBcDeF>bar</span>}baz",
    735    [["inserttext","a"]],
    736    "<p>foo<span style=\"color:rgb(171, 205, 239)\">a[]</span>baz</p>",
    737    [true],
    738    {"inserttext":[false,false,"",false,false,""]}],
    739 ["<p>[foo<span style=color:#aBcDeF>bar]</span>baz",
    740    [["stylewithcss","true"],["inserttext","a"]],
    741    "<p>a[]baz</p>",
    742    [true,true],
    743    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    744 ["<p>[foo<span style=color:#aBcDeF>bar]</span>baz",
    745    [["stylewithcss","false"],["inserttext","a"]],
    746    "<p>a[]baz</p>",
    747    [true,true],
    748    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    749 ["<p>{foo<span style=color:#aBcDeF>bar}</span>baz",
    750    [["stylewithcss","true"],["inserttext","a"]],
    751    "<p>a[]baz</p>",
    752    [true,true],
    753    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    754 ["<p>{foo<span style=color:#aBcDeF>bar}</span>baz",
    755    [["stylewithcss","false"],["inserttext","a"]],
    756    "<p>a[]baz</p>",
    757    [true,true],
    758    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    759 ["<p>foo<span style=color:#aBcDeF>[bar</span>baz]",
    760    [["inserttext","a"]],
    761    "<p>foo<span style=\"color:rgb(171, 205, 239)\">a[]</span></p>",
    762    [true],
    763    {"inserttext":[false,false,"",false,false,""]}],
    764 ["<p>foo<span style=color:#aBcDeF>{bar</span>baz}",
    765    [["inserttext","a"]],
    766    "<p>foo<span style=\"color:rgb(171, 205, 239)\">a[]</span></p>",
    767    [true],
    768    {"inserttext":[false,false,"",false,false,""]}],
    769 ["<p>foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz",
    770    [["stylewithcss","true"],["inserttext","a"]],
    771    "<p>foo<span style=\"color:rgb(171, 205, 239)\">a[]</span>quz</p>",
    772    [true,true],
    773    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    774 ["<p>foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz",
    775    [["stylewithcss","false"],["inserttext","a"]],
    776    "<p>foo<span style=\"color:rgb(171, 205, 239)\">a[]</span>quz</p>",
    777    [true,true],
    778    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    779 ["foo<b>[bar]</b>baz",
    780    [["inserttext","a"]],
    781    "foo<b>a[]</b>baz",
    782    [true],
    783    {"inserttext":[false,false,"",false,false,""]}],
    784 ["foo<i>[bar]</i>baz",
    785    [["inserttext","a"]],
    786    "foo<i>a[]</i>baz",
    787    [true],
    788    {"inserttext":[false,false,"",false,false,""]}],
    789 ["foo<s>[bar]</s>baz",
    790    [["inserttext","a"]],
    791    "foo<s>a[]</s>baz",
    792    [true],
    793    {"inserttext":[false,false,"",false,false,""]}],
    794 ["foo<sub>[bar]</sub>baz",
    795    [["inserttext","a"]],
    796    "foo<sub>a[]</sub>baz",
    797    [true],
    798    {"inserttext":[false,false,"",false,false,""]}],
    799 ["foo<sup>[bar]</sup>baz",
    800    [["inserttext","a"]],
    801    "foo<sup>a[]</sup>baz",
    802    [true],
    803    {"inserttext":[false,false,"",false,false,""]}],
    804 ["foo<u>[bar]</u>baz",
    805    [["inserttext","a"]],
    806    "foo<u>a[]</u>baz",
    807    [true],
    808    {"inserttext":[false,false,"",false,false,""]}],
    809 ["foo<a href=http://www.google.com>[bar]</a>baz",
    810    [["inserttext","a"]],
    811    "foo<a href=\"http://www.google.com\">a[]</a>baz",
    812    [true],
    813    {"inserttext":[false,false,"",false,false,""]}],
    814 ["foo<font face=sans-serif>[bar]</font>baz",
    815    [["inserttext","a"]],
    816    "foo<font face=\"sans-serif\">a[]</font>baz",
    817    [true],
    818    {"inserttext":[false,false,"",false,false,""]}],
    819 ["foo<font size=4>[bar]</font>baz",
    820    [["inserttext","a"]],
    821    "foo<font size=\"4\">a[]</font>baz",
    822    [true],
    823    {"inserttext":[false,false,"",false,false,""]}],
    824 ["foo<font color=#0000FF>[bar]</font>baz",
    825    [["inserttext","a"]],
    826    "foo<font color=\"#0000FF\">a[]</font>baz",
    827    [true],
    828    {"inserttext":[false,false,"",false,false,""]}],
    829 ["foo<span style=background-color:#00FFFF>[bar]</span>baz",
    830    [["inserttext","a"]],
    831    "foo<span style=\"background-color:rgb(0, 255, 255)\">a[]</span>baz",
    832    [true],
    833    {"inserttext":[false,false,"",false,false,""]}],
    834 ["foo<a href=http://www.google.com><font color=blue>[bar]</font></a>baz",
    835    [["inserttext","a"]],
    836    "foo<a href=\"http://www.google.com\"><font color=\"blue\">a[]</font></a>baz",
    837    [true],
    838    {"inserttext":[false,false,"",false,false,""]}],
    839 ["foo<font color=blue><a href=http://www.google.com>[bar]</a></font>baz",
    840    [["inserttext","a"]],
    841    "foo<font color=\"blue\"><a href=\"http://www.google.com\">a[]</a></font>baz",
    842    [true],
    843    {"inserttext":[false,false,"",false,false,""]}],
    844 ["foo<a href=http://www.google.com><font color=brown>[bar]</font></a>baz",
    845    [["inserttext","a"]],
    846    "foo<a href=\"http://www.google.com\"><font color=\"brown\">a[]</font></a>baz",
    847    [true],
    848    {"inserttext":[false,false,"",false,false,""]}],
    849 ["foo<font color=brown><a href=http://www.google.com>[bar]</a></font>baz",
    850    [["inserttext","a"]],
    851    "foo<font color=\"brown\"><a href=\"http://www.google.com\">a[]</a></font>baz",
    852    [true],
    853    {"inserttext":[false,false,"",false,false,""]}],
    854 ["foo<a href=http://www.google.com><font color=black>[bar]</font></a>baz",
    855    [["inserttext","a"]],
    856    "foo<a href=\"http://www.google.com\"><font color=\"black\">a[]</font></a>baz",
    857    [true],
    858    {"inserttext":[false,false,"",false,false,""]}],
    859 ["foo<a href=http://www.google.com><u>[bar]</u></a>baz",
    860    [["inserttext","a"]],
    861    "foo<a href=\"http://www.google.com\"><u>a[]</u></a>baz",
    862    [true],
    863    {"inserttext":[false,false,"",false,false,""]}],
    864 ["foo<u><a href=http://www.google.com>[bar]</a></u>baz",
    865    [["inserttext","a"]],
    866    "foo<u><a href=\"http://www.google.com\">a[]</a></u>baz",
    867    [true],
    868    {"inserttext":[false,false,"",false,false,""]}],
    869 ["foo<sub><font size=2>[bar]</font></sub>baz",
    870    [["inserttext","a"]],
    871    "foo<sub><font size=\"2\">a[]</font></sub>baz",
    872    [true],
    873    {"inserttext":[false,false,"",false,false,""]}],
    874 ["foo<font size=2><sub>[bar]</sub></font>baz",
    875    [["inserttext","a"]],
    876    "foo<font size=\"2\"><sub>a[]</sub></font>baz",
    877    [true],
    878    {"inserttext":[false,false,"",false,false,""]}],
    879 ["foo<sub><font size=3>[bar]</font></sub>baz",
    880    [["inserttext","a"]],
    881    "foo<sub><font size=\"3\">a[]</font></sub>baz",
    882    [true],
    883    {"inserttext":[false,false,"",false,false,""]}],
    884 ["foo<font size=3><sub>[bar]</sub></font>baz",
    885    [["inserttext","a"]],
    886    "foo<font size=\"3\"><sub>a[]</sub></font>baz",
    887    [true],
    888    {"inserttext":[false,false,"",false,false,""]}],
    889 ["[foo<b>bar]</b>baz",
    890    [["stylewithcss","true"],["inserttext","a"]],
    891    "a[]baz",
    892    [true,true],
    893    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    894 ["[foo<b>bar]</b>baz",
    895    [["stylewithcss","false"],["inserttext","a"]],
    896    "a[]baz",
    897    [true,true],
    898    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    899 ["[foo<i>bar]</i>baz",
    900    [["stylewithcss","true"],["inserttext","a"]],
    901    "a[]baz",
    902    [true,true],
    903    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    904 ["[foo<i>bar]</i>baz",
    905    [["stylewithcss","false"],["inserttext","a"]],
    906    "a[]baz",
    907    [true,true],
    908    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    909 ["[foo<s>bar]</s>baz",
    910    [["stylewithcss","true"],["inserttext","a"]],
    911    "a[]baz",
    912    [true,true],
    913    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    914 ["[foo<s>bar]</s>baz",
    915    [["stylewithcss","false"],["inserttext","a"]],
    916    "a[]baz",
    917    [true,true],
    918    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    919 ["[foo<sub>bar]</sub>baz",
    920    [["stylewithcss","true"],["inserttext","a"]],
    921    "a[]baz",
    922    [true,true],
    923    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    924 ["[foo<sub>bar]</sub>baz",
    925    [["stylewithcss","false"],["inserttext","a"]],
    926    "a[]baz",
    927    [true,true],
    928    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    929 ["[foo<sup>bar]</sup>baz",
    930    [["stylewithcss","true"],["inserttext","a"]],
    931    "a[]baz",
    932    [true,true],
    933    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    934 ["[foo<sup>bar]</sup>baz",
    935    [["stylewithcss","false"],["inserttext","a"]],
    936    "a[]baz",
    937    [true,true],
    938    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    939 ["[foo<u>bar]</u>baz",
    940    [["stylewithcss","true"],["inserttext","a"]],
    941    "a[]baz",
    942    [true,true],
    943    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    944 ["[foo<u>bar]</u>baz",
    945    [["stylewithcss","false"],["inserttext","a"]],
    946    "a[]baz",
    947    [true,true],
    948    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    949 ["[foo<a href=http://www.google.com>bar]</a>baz",
    950    [["inserttext","a"]],
    951    "a[]baz",
    952    [true],
    953    {"inserttext":[false,false,"",false,false,""]}],
    954 ["[foo<font face=sans-serif>bar]</font>baz",
    955    [["stylewithcss","true"],["inserttext","a"]],
    956    "a[]baz",
    957    [true,true],
    958    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    959 ["[foo<font face=sans-serif>bar]</font>baz",
    960    [["stylewithcss","false"],["inserttext","a"]],
    961    "a[]baz",
    962    [true,true],
    963    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    964 ["[foo<font size=4>bar]</font>baz",
    965    [["stylewithcss","true"],["inserttext","a"]],
    966    "a[]baz",
    967    [true,true],
    968    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    969 ["[foo<font size=4>bar]</font>baz",
    970    [["stylewithcss","false"],["inserttext","a"]],
    971    "a[]baz",
    972    [true,true],
    973    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    974 ["[foo<font color=#0000FF>bar]</font>baz",
    975    [["stylewithcss","true"],["inserttext","a"]],
    976    "a[]baz",
    977    [true,true],
    978    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    979 ["[foo<font color=#0000FF>bar]</font>baz",
    980    [["stylewithcss","false"],["inserttext","a"]],
    981    "a[]baz",
    982    [true,true],
    983    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    984 ["[foo<span style=background-color:#00FFFF>bar]</span>baz",
    985    [["stylewithcss","true"],["inserttext","a"]],
    986    "a[]baz",
    987    [true,true],
    988    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    989 ["[foo<span style=background-color:#00FFFF>bar]</span>baz",
    990    [["stylewithcss","false"],["inserttext","a"]],
    991    "a[]baz",
    992    [true,true],
    993    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
    994 ["[foo<a href=http://www.google.com><font color=blue>bar]</font></a>baz",
    995    [["stylewithcss","true"],["inserttext","a"]],
    996    "a[]baz",
    997    [true,true],
    998    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
    999 ["[foo<a href=http://www.google.com><font color=blue>bar]</font></a>baz",
   1000    [["stylewithcss","false"],["inserttext","a"]],
   1001    "a[]baz",
   1002    [true,true],
   1003    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1004 ["[foo<font color=blue><a href=http://www.google.com>bar]</a></font>baz",
   1005    [["stylewithcss","true"],["inserttext","a"]],
   1006    "a[]baz",
   1007    [true,true],
   1008    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
   1009 ["[foo<font color=blue><a href=http://www.google.com>bar]</a></font>baz",
   1010    [["stylewithcss","false"],["inserttext","a"]],
   1011    "a[]baz",
   1012    [true,true],
   1013    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1014 ["[foo<a href=http://www.google.com><font color=brown>bar]</font></a>baz",
   1015    [["stylewithcss","true"],["inserttext","a"]],
   1016    "a[]baz",
   1017    [true,true],
   1018    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
   1019 ["[foo<a href=http://www.google.com><font color=brown>bar]</font></a>baz",
   1020    [["stylewithcss","false"],["inserttext","a"]],
   1021    "a[]baz",
   1022    [true,true],
   1023    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1024 ["[foo<font color=brown><a href=http://www.google.com>bar]</a></font>baz",
   1025    [["stylewithcss","true"],["inserttext","a"]],
   1026    "a[]baz",
   1027    [true,true],
   1028    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
   1029 ["[foo<font color=brown><a href=http://www.google.com>bar]</a></font>baz",
   1030    [["stylewithcss","false"],["inserttext","a"]],
   1031    "a[]baz",
   1032    [true,true],
   1033    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1034 ["[foo<a href=http://www.google.com><font color=black>bar]</font></a>baz",
   1035    [["stylewithcss","true"],["inserttext","a"]],
   1036    "a[]baz",
   1037    [true,true],
   1038    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
   1039 ["[foo<a href=http://www.google.com><font color=black>bar]</font></a>baz",
   1040    [["stylewithcss","false"],["inserttext","a"]],
   1041    "a[]baz",
   1042    [true,true],
   1043    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1044 ["[foo<a href=http://www.google.com><u>bar]</u></a>baz",
   1045    [["stylewithcss","true"],["inserttext","a"]],
   1046    "a[]baz",
   1047    [true,true],
   1048    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
   1049 ["[foo<a href=http://www.google.com><u>bar]</u></a>baz",
   1050    [["stylewithcss","false"],["inserttext","a"]],
   1051    "a[]baz",
   1052    [true,true],
   1053    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1054 ["[foo<u><a href=http://www.google.com>bar]</a></u>baz",
   1055    [["stylewithcss","true"],["inserttext","a"]],
   1056    "a[]baz",
   1057    [true,true],
   1058    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
   1059 ["[foo<u><a href=http://www.google.com>bar]</a></u>baz",
   1060    [["stylewithcss","false"],["inserttext","a"]],
   1061    "a[]baz",
   1062    [true,true],
   1063    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1064 ["[foo<sub><font size=2>bar]</font></sub>baz",
   1065    [["stylewithcss","true"],["inserttext","a"]],
   1066    "a[]baz",
   1067    [true,true],
   1068    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
   1069 ["[foo<sub><font size=2>bar]</font></sub>baz",
   1070    [["stylewithcss","false"],["inserttext","a"]],
   1071    "a[]baz",
   1072    [true,true],
   1073    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1074 ["[foo<font size=2><sub>bar]</sub></font>baz",
   1075    [["stylewithcss","true"],["inserttext","a"]],
   1076    "a[]baz",
   1077    [true,true],
   1078    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
   1079 ["[foo<font size=2><sub>bar]</sub></font>baz",
   1080    [["stylewithcss","false"],["inserttext","a"]],
   1081    "a[]baz",
   1082    [true,true],
   1083    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1084 ["[foo<sub><font size=3>bar]</font></sub>baz",
   1085    [["stylewithcss","true"],["inserttext","a"]],
   1086    "a[]baz",
   1087    [true,true],
   1088    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
   1089 ["[foo<sub><font size=3>bar]</font></sub>baz",
   1090    [["stylewithcss","false"],["inserttext","a"]],
   1091    "a[]baz",
   1092    [true,true],
   1093    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1094 ["[foo<font size=3><sub>bar]</sub></font>baz",
   1095    [["stylewithcss","true"],["inserttext","a"]],
   1096    "a[]baz",
   1097    [true,true],
   1098    {"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
   1099 ["[foo<font size=3><sub>bar]</sub></font>baz",
   1100    [["stylewithcss","false"],["inserttext","a"]],
   1101    "a[]baz",
   1102    [true,true],
   1103    {"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
   1104 ["foo<b>[bar</b>baz]",
   1105    [["inserttext","a"]],
   1106    "foo<b>a[]</b>",
   1107    [true],
   1108    {"inserttext":[false,false,"",false,false,""]}],
   1109 ["foo<i>[bar</i>baz]",
   1110    [["inserttext","a"]],
   1111    "foo<i>a[]</i>",
   1112    [true],
   1113    {"inserttext":[false,false,"",false,false,""]}],
   1114 ["foo<s>[bar</s>baz]",
   1115    [["inserttext","a"]],
   1116    "foo<s>a[]</s>",
   1117    [true],
   1118    {"inserttext":[false,false,"",false,false,""]}],
   1119 ["foo<sub>[bar</sub>baz]",
   1120    [["inserttext","a"]],
   1121    "foo<sub>a[]</sub>",
   1122    [true],
   1123    {"inserttext":[false,false,"",false,false,""]}],
   1124 ["foo<sup>[bar</sup>baz]",
   1125    [["inserttext","a"]],
   1126    "foo<sup>a[]</sup>",
   1127    [true],
   1128    {"inserttext":[false,false,"",false,false,""]}],
   1129 ["foo<u>[bar</u>baz]",
   1130    [["inserttext","a"]],
   1131    "foo<u>a[]</u>",
   1132    [true],
   1133    {"inserttext":[false,false,"",false,false,""]}],
   1134 ["foo<a href=http://www.google.com>[bar</a>baz]",
   1135    [["inserttext","a"]],
   1136    "fooa[]",
   1137    [true],
   1138    {"inserttext":[false,false,"",false,false,""]}],
   1139 ["foo<font face=sans-serif>[bar</font>baz]",
   1140    [["inserttext","a"]],
   1141    "foo<font face=\"sans-serif\">a[]</font>",
   1142    [true],
   1143    {"inserttext":[false,false,"",false,false,""]}],
   1144 ["foo<font size=4>[bar</font>baz]",
   1145    [["inserttext","a"]],
   1146    "foo<font size=\"4\">a[]</font>",
   1147    [true],
   1148    {"inserttext":[false,false,"",false,false,""]}],
   1149 ["foo<font color=#0000FF>[bar</font>baz]",
   1150    [["inserttext","a"]],
   1151    "foo<font color=\"#0000FF\">a[]</font>",
   1152    [true],
   1153    {"inserttext":[false,false,"",false,false,""]}],
   1154 ["foo<span style=background-color:#00FFFF>[bar</span>baz]",
   1155    [["inserttext","a"]],
   1156    "foo<span style=\"background-color:rgb(0, 255, 255)\">a[]</span>",
   1157    [true],
   1158    {"inserttext":[false,false,"",false,false,""]}],
   1159 // <a href> should always be removed if entirely replaced.
   1160 ["foo<a href=http://www.google.com><font color=blue>[bar</font></a>baz]",
   1161    [["inserttext","a"]],
   1162    "foo<font color=\"blue\">a[]</font>",
   1163    [true],
   1164    {"inserttext":[false,false,"",false,false,""]}],
   1165 ["foo<font color=blue><a href=http://www.google.com>[bar</a></font>baz]",
   1166    [["inserttext","a"]],
   1167    "foo<font color=\"blue\">a[]</font>",
   1168    [true],
   1169    {"inserttext":[false,false,"",false,false,""]}],
   1170 ["foo<a href=http://www.google.com><font color=brown>[bar</font></a>baz]",
   1171    [["inserttext","a"]],
   1172    "foo<font color=\"brown\">a[]</font>",
   1173    [true],
   1174    {"inserttext":[false,false,"",false,false,""]}],
   1175 ["foo<font color=brown><a href=http://www.google.com>[bar</a></font>baz]",
   1176    [["inserttext","a"]],
   1177    "foo<font color=\"brown\">a[]</font>",
   1178    [true],
   1179    {"inserttext":[false,false,"",false,false,""]}],
   1180 ["foo<a href=http://www.google.com><font color=black>[bar</font></a>baz]",
   1181    [["inserttext","a"]],
   1182    "foo<font color=\"black\">a[]</font>",
   1183    [true],
   1184    {"inserttext":[false,false,"",false,false,""]}],
   1185 ["foo<a href=http://www.google.com><u>[bar</u></a>baz]",
   1186    [["inserttext","a"]],
   1187    "foo<u>a[]</u>",
   1188    [true],
   1189    {"inserttext":[false,false,"",false,false,""]}],
   1190 ["foo<u><a href=http://www.google.com>[bar</a></u>baz]",
   1191    [["inserttext","a"]],
   1192    "foo<u>a[]</u>",
   1193    [true],
   1194    {"inserttext":[false,false,"",false,false,""]}],
   1195 ["foo<sub><font size=2>[bar</font></sub>baz]",
   1196    [["inserttext","a"]],
   1197    "foo<sub><font size=\"2\">a[]</font></sub>",
   1198    [true],
   1199    {"inserttext":[false,false,"",false,false,""]}],
   1200 ["foo<font size=2><sub>[bar</sub></font>baz]",
   1201    [["inserttext","a"]],
   1202    "foo<font size=\"2\"><sub>a[]</sub></font>",
   1203    [true],
   1204    {"inserttext":[false,false,"",false,false,""]}],
   1205 ["foo<sub><font size=3>[bar</font></sub>baz]",
   1206    [["inserttext","a"]],
   1207    "foo<sub><font size=\"3\">a[]</font></sub>",
   1208    [true],
   1209    {"inserttext":[false,false,"",false,false,""]}],
   1210 ["foo<font size=3><sub>[bar</sub></font>baz]",
   1211    [["inserttext","a"]],
   1212    "foo<font size=\"3\"><sub>a[]</sub></font>",
   1213    [true],
   1214    {"inserttext":[false,false,"",false,false,""]}],
   1215 ["<blockquote><font color=blue>[foo]</font></blockquote>",
   1216    [["inserttext","a"]],
   1217    "<blockquote><font color=\"blue\">a[]</font></blockquote>",
   1218    [true],
   1219    {"inserttext":[false,false,"",false,false,""]}],
   1220 ["<div>[] abc</div>",
   1221    [["inserttext"," "]],
   1222    "<div>&nbsp;abc</div>",
   1223    [true],
   1224    {"inserttext":[false,false,"",false,false,""]}],
   1225 ["<div> []abc</div>",
   1226    [["inserttext"," "]],
   1227    "<div>&nbsp;abc</div>",
   1228    [true],
   1229    {"inserttext":[false,false,"",false,false,""]}],
   1230 ["<div>[]  abc</div>",
   1231    [["inserttext"," "]],
   1232    "<div>&nbsp;abc</div>",
   1233    [true],
   1234    {"inserttext":[false,false,"",false,false,""]}],
   1235 ["<div> [] abc</div>",
   1236    [["inserttext"," "]],
   1237    "<div>&nbsp;abc</div>",
   1238    [true],
   1239    {"inserttext":[false,false,"",false,false,""]}],
   1240 ["<div>  []abc</div>",
   1241    [["inserttext"," "]],
   1242    "<div>&nbsp;abc</div>",
   1243    [true],
   1244    {"inserttext":[false,false,"",false,false,""]}],
   1245 ["<div>abc[] </div>",
   1246    [["inserttext"," "]],
   1247    "<div>abc&nbsp;</div>",
   1248    [true],
   1249    {"inserttext":[false,false,"",false,false,""]}],
   1250 ["<div>abc []</div>",
   1251    [["inserttext"," "]],
   1252    "<div>abc&nbsp;</div>",
   1253    [true],
   1254    {"inserttext":[false,false,"",false,false,""]}],
   1255 ["<div>abc[]  </div>",
   1256    [["inserttext"," "]],
   1257    "<div>abc&nbsp;</div>",
   1258    [true],
   1259    {"inserttext":[false,false,"",false,false,""]}],
   1260 ["<div>abc [] </div>",
   1261    [["inserttext"," "]],
   1262    "<div>abc&nbsp;</div>",
   1263    [true],
   1264    {"inserttext":[false,false,"",false,false,""]}],
   1265 ["<div>abc  []</div>",
   1266    [["inserttext"," "]],
   1267    "<div>abc&nbsp;</div>",
   1268    [true],
   1269    {"inserttext":[false,false,"",false,false,""]}],
   1270 ["<br>{}",
   1271    [["inserttext","a"]],
   1272    "a",
   1273    [true],
   1274    {"inserttext":[false,false,"",false,false,""]}],
   1275 ["abc<br>{}",
   1276    [["inserttext","d"]],
   1277    "abcd",
   1278    [true],
   1279    {"inserttext":[false,false,"",false,false,""]}],
   1280 ["abc<br>{}<br>",
   1281    [["inserttext","d"]],
   1282    "abc<br>d",
   1283    [true],
   1284    {"inserttext":[false,false,"",false,false,""]}],
   1285 ["<span contenteditable=false>abc</span><br>{}",
   1286    [["inserttext","d"]],
   1287    "<span contenteditable=\"false\">abc</span>d",
   1288    [true],
   1289    {"inserttext":[false,false,"",false,false,""]}],
   1290 ["<div contenteditable=false><span contenteditable><br>{}</span></div>",
   1291    [["inserttext","a"]],
   1292    "<div contenteditable=\"false\"><span contenteditable=\"\">a</span></div>",
   1293    [true],
   1294    {"inserttext":[false,false,"",false,false,""]}],
   1295 ["<div contenteditable=false><span contenteditable>abc<br>{}</span></div>",
   1296    [["inserttext","d"]],
   1297    "<div contenteditable=\"false\"><span contenteditable=\"\">abcd</span></div>",
   1298    [true],
   1299    {"inserttext":[false,false,"",false,false,""]}],
   1300 ["<div style=white-space:pre>foo[]bar</div>",
   1301    [["inserttext","    "]],
   1302    "<div style=\"white-space:pre\">foo    bar</div>",
   1303    [true],
   1304    {"inserttext":[false,false,"",false,false,""]}],
   1305 ["<div style=white-space:pre>foo[]</div>",
   1306    [["inserttext","    "]],
   1307    "<div style=\"white-space:pre\">foo    </div>",
   1308    [true],
   1309    {"inserttext":[false,false,"",false,false,""]}],
   1310 ["<div style=white-space:pre-wrap>foo[]bar</div>",
   1311    [["inserttext","    "]],
   1312    "<div style=\"white-space:pre-wrap\">foo    bar</div>",
   1313    [true],
   1314    {"inserttext":[false,false,"",false,false,""]}],
   1315 ["<div style=white-space:pre-wrap>foo[]</div>",
   1316    [["inserttext","    "]],
   1317    "<div style=\"white-space:pre-wrap\">foo    </div>",
   1318    [true],
   1319    {"inserttext":[false,false,"",false,false,""]}],
   1320 // FYI: The white-space sequence different does not matter here.  It's tested
   1321 //      in white-spaces-after-execCommand-inserttext.tentative.html.
   1322 ["<div style=white-space:pre-line>foo[]bar</div>",
   1323    [["inserttext","    "]],
   1324    ["<div style=\"white-space:pre-line\">foo &nbsp; &nbsp;bar</div>",
   1325     "<div style=\"white-space:pre-line\">foo&nbsp; &nbsp; bar</div>"],
   1326    [true],
   1327    {"inserttext":[false,false,"",false,false,""]}],
   1328 ["<div style=white-space:pre-line>foo[]</div>",
   1329    [["inserttext","    "]],
   1330    ["<div style=\"white-space:pre-line\">foo &nbsp; &nbsp;</div>",
   1331     "<div style=\"white-space:pre-line\">foo&nbsp; &nbsp;&nbsp;</div>"],
   1332    [true],
   1333    {"inserttext":[false,false,"",false,false,""]}],
   1334 ["<div style=white-space:nowrap>foo[]bar</div>",
   1335    [["inserttext","    "]],
   1336    ["<div style=\"white-space:nowrap\">foo &nbsp; &nbsp;bar</div>",
   1337     "<div style=\"white-space:nowrap\">foo&nbsp; &nbsp; bar</div>"],
   1338    [true],
   1339    {"inserttext":[false,false,"",false,false,""]}],
   1340 ["<div style=white-space:nowrap>foo[]</div>",
   1341    [["inserttext","    "]],
   1342    ["<div style=\"white-space:nowrap\">foo &nbsp; &nbsp;</div>",
   1343     "<div style=\"white-space:nowrap\">foo&nbsp; &nbsp;&nbsp;</div>"],
   1344    [true],
   1345    {"inserttext":[false,false,"",false,false,""]}],
   1346 // If selection is after a <br> element in a block and the <br> element follows
   1347 // last visible thing in the block, content should be inserted before the <br>
   1348 // element.
   1349 ["<p>a<br>{}<span></span></p>",
   1350    [["inserttext","b"]],
   1351    "<p>ab<span></span></p>",
   1352    [true],
   1353    {"inserttext":[false,false,"",false,false,""]}],
   1354 // In these cases, the <span> element after <br> element is visible and is put in
   1355 // the second line and caret is in the second line.  Therefore, new text should
   1356 // be inserted into the second line.
   1357 ["<p style=\"white-space:pre-wrap\">a<br>{}<span style=\"padding:1px\"></span></p>",
   1358    [["inserttext","b"]],
   1359    "<p style=\"white-space:pre-wrap\">a<br>b<span style=\"padding:1px\"></span></p>",
   1360    [true],
   1361    {"inserttext":[false,false,"",false,false,""]}],
   1362 ["<div style=\"white-space:pre-wrap\">a<br>{}<span style=\"padding:1px\"></span><p>c</p></div>",
   1363    [["inserttext","b"]],
   1364    "<div style=\"white-space:pre-wrap\">a<br>b<span style=\"padding:1px\"></span><p>c</p></div>",
   1365    [true],
   1366    {"inserttext":[false,false,"",false,false,""]}],
   1367 // Similar case if <br> follows last visible thing and is followed by invisible
   1368 // inline element and a block.  In this case, Chrome inserts text into the
   1369 // following block so that the expectation follows it.
   1370 ["<div>a<br>{}<span></span><p>c</p></div>",
   1371    [["inserttext","b"]],
   1372    "<div>a<br><span></span><p>bc</p></div>",
   1373    [true],
   1374    {"inserttext":[false,false,"",false,false,""]}],
   1375 // https://bugzilla.mozilla.org/show_bug.cgi?id=1785801
   1376 ["<div>abc{</div><div>}efg</div>",
   1377    [["inserttext", "d"]],
   1378    "<div>abcdefg</div>",
   1379    [true],
   1380    {"inserttext":[false,false,"",false,false,""]}],
   1381 
   1382 // Tests preserving inline style of the last visible thing in the selection
   1383 // for replacing text.
   1384 ["<div>abc{<b><i>def</i></b>}ghi</div>",
   1385    [["inserttext","d"],["inserttext","e"],["inserttext","f"]],
   1386    "<div>abc<b><i>def</i></b>ghi</div>",
   1387    [true,true,true],
   1388    {}],
   1389 ["<div>abc<b><i>[def]</i></b>ghi</div>",
   1390    [["inserttext","d"],["inserttext","e"],["inserttext","f"]],
   1391    "<div>abc<b><i>def</i></b>ghi</div>",
   1392    [true,true,true],
   1393    {}],
   1394 ["<div>abc[<b><i>def]</i></b>ghi</div>",
   1395    [["inserttext","d"],["inserttext","e"],["inserttext","f"]],
   1396    "<div>abc<b><i>def</i></b>ghi</div>",
   1397    [true,true,true],
   1398    {}],
   1399 ["<div>abc<b><i>[def</i></b>]ghi</div>",
   1400    [["inserttext","d"],["inserttext","e"],["inserttext","f"]],
   1401    "<div>abc<b><i>def</i></b>ghi</div>",
   1402    [true,true,true],
   1403    {}],
   1404 ["<div>abc<b><i>[def</i></b>g]hi</div>",
   1405    [["inserttext","d"],["inserttext","e"],["inserttext","f"],["inserttext","g"]],
   1406    "<div>abc<b><i>defg</i></b>hi</div>",
   1407    [true,true,true,true],
   1408    {}],
   1409 ["<div>abc[<b><i>def</i></b>g]hi</div>",
   1410    [["inserttext","d"],["inserttext","e"],["inserttext","f"],["inserttext","g"]],
   1411    "<div>abc<b><i>defg</i></b>hi</div>",
   1412    [true,true,true,true],
   1413    {}],
   1414 ["<div>abc{<b><i>def</i></b>g]hi</div>",
   1415    [["inserttext","d"],["inserttext","e"],["inserttext","f"],["inserttext","g"]],
   1416    "<div>abc<b><i>defg</i></b>hi</div>",
   1417    [true,true,true,true],
   1418    {}],
   1419 // Don't preserve inline styles if first content is <img> and it's replaced.
   1420 ["<div>abc[<b><i><img src=\"/img/lion.svg\">de]f</i></b>ghi</div>",
   1421    [["inserttext","d"],["inserttext","e"]],
   1422    "<div>abcde<b><i>f</i></b>ghi</div>",
   1423    [true,true],
   1424    {}],
   1425 ["<div>abc[<b><i><img src=\"/img/lion.svg\">def]</i></b>ghi</div>",
   1426    [["inserttext","d"],["inserttext","e"],["inserttext","f"]],
   1427    "<div>abcdefghi</div>",
   1428    [true,true,true],
   1429    {}],
   1430 ["<div>abc[<b><i><img src=\"/img/lion.svg\">def</i></b>]ghi</div>",
   1431    [["inserttext","d"],["inserttext","e"],["inserttext","f"]],
   1432    "<div>abcdefghi</div>",
   1433    [true,true,true],
   1434    {}],
   1435 ["<div>abc{<b><i><img src=\"/img/lion.svg\">def</i></b>]ghi</div>",
   1436    [["inserttext","d"],["inserttext","e"],["inserttext","f"]],
   1437    "<div>abcdefghi</div>",
   1438    [true,true,true],
   1439    {}],
   1440 // Don't preserve inline styles even if end boundary is styled.
   1441 ["<div>ab[c<b><i>de]f</i></b>ghi</div>",
   1442    [["inserttext","c"],["inserttext","d"],["inserttext","e"]],
   1443    "<div>abcde<b><i>f</i></b>ghi</div>",
   1444    [true,true,true],
   1445    {}],
   1446 // But preserve inline styles if first content is styled.
   1447 ["<div>abc[<b><i>de]f</i></b>ghi</div>",
   1448    [["inserttext","d"],["inserttext","e"]],
   1449    "<div>abc<b><i>def</i></b>ghi</div>",
   1450    [true,true],
   1451    {}],
   1452 ["<div>abc{<b><i>de]f</i></b>ghi</div>",
   1453    [["inserttext","d"],["inserttext","e"]],
   1454    "<div>abc<b><i>def</i></b>ghi</div>",
   1455    [true,true],
   1456    {}],
   1457 // Don't preserve empty inline style, but preserve the following text style if first content is text
   1458 ["<div>abc[<s></s><b><i>de]f</i></b>ghi</div>",
   1459    [["inserttext","d"],["inserttext","e"]],
   1460    ["<div>abc<b><i>def</i></b>ghi</div>",
   1461     "<div>abc<s></s><b><i>def</i></b>ghi</div>"],
   1462    [true,true],
   1463    {}],
   1464 ["<div>abc{<s></s><b><i>de]f</i></b>ghi</div>",
   1465    [["inserttext","d"],["inserttext","e"]],
   1466    ["<div>abc<b><i>def</i></b>ghi</div>",
   1467     "<div>abc<s></s><b><i>def</i></b>ghi</div>"],
   1468    [true,true],
   1469    {}],
   1470 // Don't remove parent blocks of selection start to insert new text into the
   1471 // selection start container.
   1472 ["<div>{abc</div><div>def</div>}",
   1473    [["inserttext","g"],["inserttext","h"]],
   1474    "<div>gh</div>",
   1475    [true,true],
   1476    {}],
   1477 ["<div>abc</div><div>{def</div>}",
   1478    [["inserttext","g"],["inserttext","h"]],
   1479    "<div>abc</div><div>gh</div>",
   1480    [true,true],
   1481    {}],
   1482 ["<div style=display:flex><span>{abc</span><span>def</span>}</div>",
   1483    [["inserttext","g"],["inserttext","h"]],
   1484    "<div style=\"display:flex\"><span>gh</span></div>",
   1485    [true,true],
   1486    {}],
   1487 ["<div style=display:flex><span>abc</span><span>{def</span>}</div>",
   1488    [["inserttext","g"],["inserttext","h"]],
   1489    "<div style=\"display:flex\"><span>abc</span><span>gh</span></div>",
   1490    [true,true],
   1491    {}],
   1492 ["<div style=display:grid><span>{abc</span><span>def</span>}</div>",
   1493    [["inserttext","g"],["inserttext","h"]],
   1494    "<div style=\"display:grid\"><span>gh</span></div>",
   1495    [true,true],
   1496    {}],
   1497 ["<div style=display:grid><span>abc</span><span>{def</span>}</div>",
   1498    [["inserttext","g"],["inserttext","h"]],
   1499    "<div style=\"display:grid\"><span>abc</span><span>gh</span></div>",
   1500    [true,true],
   1501    {}],
   1502 // The inline style at selection start should be preserved for typed text.
   1503 ["<div><b>{abc</b></div><div>def</div>}",
   1504    [["inserttext","g"],["inserttext","h"]],
   1505    "<div><b>gh</b></div>",
   1506    [true,true],
   1507    {}],
   1508 ["<div>abc</div><div><b>{def</b></div>}",
   1509    [["inserttext","g"],["inserttext","h"]],
   1510    "<div>abc</div><div><b>gh</b></div>",
   1511    [true,true],
   1512    {}],
   1513 ["<div style=display:flex><span><b>{abc</b></span><span>def</span>}</div>",
   1514    [["inserttext","g"],["inserttext","h"]],
   1515    "<div style=\"display:flex\"><span><b>gh</b></span></div>",
   1516    [true,true],
   1517    {}],
   1518 ["<div style=display:flex><span>abc</span><span><b>{def</b></span>}</div>",
   1519    [["inserttext","g"],["inserttext","h"]],
   1520    "<div style=\"display:flex\"><span>abc</span><span><b>gh</b></span></div>",
   1521    [true,true],
   1522    {}],
   1523 ["<div style=display:grid><span><b>{abc</b></span><span>def</span>}</div>",
   1524    [["inserttext","g"],["inserttext","h"]],
   1525    "<div style=\"display:grid\"><span><b>gh</b></span></div>",
   1526    [true,true],
   1527    {}],
   1528 ["<div style=display:grid><span>abc</span><span><b>{def</b></span>}</div>",
   1529    [["inserttext","g"],["inserttext","h"]],
   1530    "<div style=\"display:grid\"><span>abc</span><span><b>gh</b></span></div>",
   1531    [true,true],
   1532    {}],
   1533 
   1534 ["<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>",
   1535    [["inserttext","B"]],
   1536    "<table><tbody><tr><td>a</td><td><b>B</b></td><td><br></td><td><br></td><td>e</td></tr></tbody></table>",
   1537    [true],
   1538    {}],
   1539 ["<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>",
   1540    [["inserttext","B"]],
   1541    "<table><tbody><tr><th>a</th><th><b>B</b></th><th><br></th><th><br></th><th>e</th></tr></tbody></table>",
   1542    [true],
   1543    {}],
   1544 
   1545 // The expectations of these flex item scenarios based on Chrome 142.
   1546 // Feel free to change them if it's discussed in the Editing WG.
   1547 ["<div style=display:flex><span>[]abc</span><span>def</span></div>",
   1548    [["inserttext"," "]],
   1549    "<div style=\"display:flex\"><span>&nbsp;abc</span><span>def</span></div>",
   1550    [true],
   1551    {}],
   1552 ["<div style=display:inline-flex><span>[]abc</span><span>def</span></div>",
   1553    [["inserttext"," "]],
   1554    "<div style=\"display:inline-flex\"><span>&nbsp;abc</span><span>def</span></div>",
   1555    [true],
   1556    {}],
   1557 ["<div style=display:flex><span>abc[]</span><span>def</span></div>",
   1558    [["inserttext"," "]],
   1559    "<div style=\"display:flex\"><span>abc&nbsp;</span><span>def</span></div>",
   1560    [true],
   1561    {}],
   1562 ["<div style=display:inline-flex><span>abc[]</span><span>def</span></div>",
   1563    [["inserttext"," "]],
   1564    "<div style=\"display:inline-flex\"><span>abc&nbsp;</span><span>def</span></div>",
   1565    [true],
   1566    {}],
   1567 ["<div style=display:flex><span>abc</span><span>[]def</span></div>",
   1568    [["inserttext"," "]],
   1569    "<div style=\"display:flex\"><span>abc</span><span>&nbsp;def</span></div>",
   1570    [true],
   1571    {}],
   1572 ["<div style=display:inline-flex><span>abc</span><span>[]def</span></div>",
   1573    [["inserttext"," "]],
   1574    "<div style=\"display:inline-flex\"><span>abc</span><span>&nbsp;def</span></div>",
   1575    [true],
   1576    {}],
   1577 ["<div style=display:flex><span>abc</span><span>def[]</span></div>",
   1578    [["inserttext"," "]],
   1579    "<div style=\"display:flex\"><span>abc</span><span>def&nbsp;</span></div>",
   1580    [true],
   1581    {}],
   1582 ["<div style=display:inline-flex><span>abc</span><span>def[]</span></div>",
   1583    [["inserttext"," "]],
   1584    "<div style=\"display:inline-flex\"><span>abc</span><span>def&nbsp;</span></div>",
   1585    [true],
   1586    {}],
   1587 
   1588 // The expectations of these grid item scenarios based on Chrome 142.
   1589 // Feel free to change them if it's discussed in the Editing WG.
   1590 ["<div style=display:grid><span>[]abc</span><span>def</span></div>",
   1591    [["inserttext"," "]],
   1592    "<div style=\"display:grid\"><span>&nbsp;abc</span><span>def</span></div>",
   1593    [true],
   1594    {}],
   1595 ["<div style=display:inline-grid><span>[]abc</span><span>def</span></div>",
   1596    [["inserttext"," "]],
   1597    "<div style=\"display:inline-grid\"><span>&nbsp;abc</span><span>def</span></div>",
   1598    [true],
   1599    {}],
   1600 ["<div style=display:grid><span>abc[]</span><span>def</span></div>",
   1601    [["inserttext"," "]],
   1602    "<div style=\"display:grid\"><span>abc&nbsp;</span><span>def</span></div>",
   1603    [true],
   1604    {}],
   1605 ["<div style=display:inline-grid><span>abc[]</span><span>def</span></div>",
   1606    [["inserttext"," "]],
   1607    "<div style=\"display:inline-grid\"><span>abc&nbsp;</span><span>def</span></div>",
   1608    [true],
   1609    {}],
   1610 ["<div style=display:grid><span>abc</span><span>[]def</span></div>",
   1611    [["inserttext"," "]],
   1612    "<div style=\"display:grid\"><span>abc</span><span>&nbsp;def</span></div>",
   1613    [true],
   1614    {}],
   1615 ["<div style=display:inline-grid><span>abc</span><span>[]def</span></div>",
   1616    [["inserttext"," "]],
   1617    "<div style=\"display:inline-grid\"><span>abc</span><span>&nbsp;def</span></div>",
   1618    [true],
   1619    {}],
   1620 ["<div style=display:grid><span>abc</span><span>def[]</span></div>",
   1621    [["inserttext"," "]],
   1622    "<div style=\"display:grid\"><span>abc</span><span>def&nbsp;</span></div>",
   1623    [true],
   1624    {}],
   1625 ["<div style=display:inline-grid><span>abc</span><span>def[]</span></div>",
   1626    [["inserttext"," "]],
   1627    "<div style=\"display:inline-grid\"><span>abc</span><span>def&nbsp;</span></div>",
   1628    [true],
   1629    {}],
   1630 ]