inserthtml.js (29169B)
1 // For documentation of the format, see README in this directory. 2 var browserTests = [ 3 ["foo[]bar", 4 [["stylewithcss","true"],["inserthtml","ab<b>c</b>d"]], 5 "fooab<b>c</b>d{}bar", 6 [true,true], 7 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 8 ["foo[]bar", 9 [["stylewithcss","false"],["inserthtml","ab<b>c</b>d"]], 10 "fooab<b>c</b>d{}bar", 11 [true,true], 12 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 13 ["foo[bar]baz", 14 [["stylewithcss","true"],["inserthtml","ab<b>c</b>d"]], 15 "fooab<b>c</b>d{}baz", 16 [true,true], 17 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 18 ["foo[bar]baz", 19 [["stylewithcss","false"],["inserthtml","ab<b>c</b>d"]], 20 "fooab<b>c</b>d{}baz", 21 [true,true], 22 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 23 ["foo<span style=color:#aBcDeF>[bar]</span>baz", 24 [["stylewithcss","true"],["inserthtml","ab<b>c</b>d"]], 25 "fooab<b>c</b>d{}baz", 26 [true,true], 27 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 28 ["foo<span style=color:#aBcDeF>[bar]</span>baz", 29 [["stylewithcss","false"],["inserthtml","ab<b>c</b>d"]], 30 "fooab<b>c</b>d{}baz", 31 [true,true], 32 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 33 ["foo<span style=color:#aBcDeF>{bar}</span>baz", 34 [["stylewithcss","true"],["inserthtml","ab<b>c</b>d"]], 35 "fooab<b>c</b>d{}baz", 36 [true,true], 37 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 38 ["foo<span style=color:#aBcDeF>{bar}</span>baz", 39 [["stylewithcss","false"],["inserthtml","ab<b>c</b>d"]], 40 "fooab<b>c</b>d{}baz", 41 [true,true], 42 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 43 ["foo{<span style=color:#aBcDeF>bar</span>}baz", 44 [["stylewithcss","true"],["inserthtml","ab<b>c</b>d"]], 45 "fooab<b>c</b>d{}baz", 46 [true,true], 47 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 48 ["foo{<span style=color:#aBcDeF>bar</span>}baz", 49 [["stylewithcss","false"],["inserthtml","ab<b>c</b>d"]], 50 "fooab<b>c</b>d{}baz", 51 [true,true], 52 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 53 ["[foo<span style=color:#aBcDeF>bar]</span>baz", 54 [["stylewithcss","true"],["inserthtml","ab<b>c</b>d"]], 55 "ab<b>c</b>d{}baz", 56 [true,true], 57 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 58 ["[foo<span style=color:#aBcDeF>bar]</span>baz", 59 [["stylewithcss","false"],["inserthtml","ab<b>c</b>d"]], 60 "ab<b>c</b>d{}baz", 61 [true,true], 62 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 63 ["{foo<span style=color:#aBcDeF>bar}</span>baz", 64 [["stylewithcss","true"],["inserthtml","ab<b>c</b>d"]], 65 "ab<b>c</b>d{}baz", 66 [true,true], 67 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 68 ["{foo<span style=color:#aBcDeF>bar}</span>baz", 69 [["stylewithcss","false"],["inserthtml","ab<b>c</b>d"]], 70 "ab<b>c</b>d{}baz", 71 [true,true], 72 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 73 ["foo<span style=color:#aBcDeF>[bar</span>baz]", 74 [["stylewithcss","true"],["inserthtml","ab<b>c</b>d"]], 75 "fooab<b>c</b>d{}", 76 [true,true], 77 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 78 ["foo<span style=color:#aBcDeF>[bar</span>baz]", 79 [["stylewithcss","false"],["inserthtml","ab<b>c</b>d"]], 80 "fooab<b>c</b>d{}", 81 [true,true], 82 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 83 ["foo<span style=color:#aBcDeF>{bar</span>baz}", 84 [["stylewithcss","true"],["inserthtml","ab<b>c</b>d"]], 85 "fooab<b>c</b>d{}", 86 [true,true], 87 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 88 ["foo<span style=color:#aBcDeF>{bar</span>baz}", 89 [["stylewithcss","false"],["inserthtml","ab<b>c</b>d"]], 90 "fooab<b>c</b>d{}", 91 [true,true], 92 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 93 ["foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz", 94 [["stylewithcss","true"],["inserthtml","ab<b>c</b>d"]], 95 "fooab<b>c</b>d{}quz", 96 [true,true], 97 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 98 ["foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz", 99 [["stylewithcss","false"],["inserthtml","ab<b>c</b>d"]], 100 "fooab<b>c</b>d{}quz", 101 [true,true], 102 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 103 ["foo[bar]baz", 104 [["inserthtml",""]], 105 "foo[]baz", 106 [true], 107 {"inserthtml":[false,false,"",false,false,""]}], 108 ["foo[bar]baz", 109 [["inserthtml","\u0000"]], 110 "foo[]baz", 111 [true], 112 {"inserthtml":[false,false,"",false,false,""]}], 113 ["foo[bar]baz", 114 [["inserthtml","\u0007"]], 115 "foo\u0007{}baz", 116 [true], 117 {"inserthtml":[false,false,"",false,false,""]}], 118 ["foo[bar]baz", 119 [["stylewithcss","true"],["inserthtml","<b>"]], 120 "foo<b></b>{}baz", 121 [true,true], 122 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 123 ["foo[bar]baz", 124 [["stylewithcss","false"],["inserthtml","<b>"]], 125 "foo<b></b>{}baz", 126 [true,true], 127 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 128 ["foo[bar]baz", 129 [["stylewithcss","true"],["inserthtml","<b>abc"]], 130 "foo<b>abc</b>{}baz", 131 [true,true], 132 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 133 ["foo[bar]baz", 134 [["stylewithcss","false"],["inserthtml","<b>abc"]], 135 "foo<b>abc</b>{}baz", 136 [true,true], 137 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 138 ["<p>foo[bar]baz", 139 [["defaultparagraphseparator","div"],["inserthtml","<p>abc"]], 140 "<p>foo</p><p>abc</p>{}<p>baz</p>", 141 [true,true], 142 {"defaultparagraphseparator":[false,false,"div",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 143 ["<p>foo[bar]baz", 144 [["defaultparagraphseparator","p"],["inserthtml","<p>abc"]], 145 "<p>foo</p><p>abc</p>{}<p>baz</p>", 146 [true,true], 147 {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 148 ["<p>foo[bar]baz", 149 [["defaultparagraphseparator","div"],["inserthtml","<li>abc"]], 150 "<p>foo</p><div>abc</div>{}<p>baz</p>", 151 [true,true], 152 {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 153 ["<p>foo[bar]baz", 154 [["defaultparagraphseparator","p"],["inserthtml","<li>abc"]], 155 "<p>foo</p><p>abc</p>{}<p>baz</p>", 156 [true,true], 157 {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 158 ["<ol>{<li>foo</li>}<li>bar</ol>", 159 [["defaultparagraphseparator","div"],["inserthtml","<p>abc"]], 160 "<p>abc</p>{}<ol><li>bar</li></ol>", 161 [true,true], 162 {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 163 ["<ol>{<li>foo</li>}<li>bar</ol>", 164 [["defaultparagraphseparator","p"],["inserthtml","<p>abc"]], 165 "<p>abc</p>{}<ol><li>bar</li></ol>", 166 [true,true], 167 {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 168 ["<ol><li>foo</li>{<li>bar</li>}<li>baz</ol>", 169 [["defaultparagraphseparator","div"],["inserthtml","<p>abc"]], 170 "<ol><li>foo</li></ol><p>abc</p>{}<ol><li>baz</li></ol>", 171 [true,true], 172 {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 173 ["<ol><li>foo</li>{<li>bar</li>}<li>baz</ol>", 174 [["defaultparagraphseparator","p"],["inserthtml","<p>abc"]], 175 "<ol><li>foo</li></ol><p>abc</p>{}<ol><li>baz</li></ol>", 176 [true,true], 177 {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 178 ["<ol><li>[foo]</li><li>bar</ol>", 179 [["defaultparagraphseparator","div"],["inserthtml","<p>abc"]], 180 "<ol><li><p>abc</p>{}</li><li>bar</li></ol>", 181 [true,true], 182 {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 183 ["<ol><li>[foo]</li><li>bar</ol>", 184 [["defaultparagraphseparator","p"],["inserthtml","<p>abc"]], 185 "<ol><li><p>abc</p>{}</li><li>bar</li></ol>", 186 [true,true], 187 {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 188 ["<xmp>f[o]o</xmp>", 189 [["inserthtml","abc"]], 190 "<xmp>fabc{}o</xmp>", 191 [true], 192 {"inserthtml":[false,false,"",false,false,""]}], 193 ["<xmp>f[o]o</xmp>", 194 [["stylewithcss","true"],["inserthtml","<b>abc</b>"]], 195 "<xmp>f<b>abc</b>{}o</xmp>", 196 [true,true], 197 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 198 ["<xmp>f[o]o</xmp>", 199 [["stylewithcss","false"],["inserthtml","<b>abc</b>"]], 200 "<xmp>f<b>abc</b>{}o</xmp>", 201 [true,true], 202 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 203 ["<script>f[o]o</script>bar", 204 [["inserthtml","abc"]], 205 "<script>fabc{}o</script>bar", 206 [true], 207 {"inserthtml":[false,false,"",false,false,""]}], 208 ["<script>f[o]o</script>bar", 209 [["stylewithcss","true"],["inserthtml","<b>abc</b>"]], 210 "<script>f<b>abc</b>{}o</script>bar", 211 [true,true], 212 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 213 ["<script>f[o]o</script>bar", 214 [["stylewithcss","false"],["inserthtml","<b>abc</b>"]], 215 "<script>f<b>abc</b>{}o</script>bar", 216 [true,true], 217 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 218 ["<a>f[o]o</a>", 219 [["inserthtml","<a>abc</a>"]], 220 "<a>f</a><a>abc</a>{}<a>o</a>", 221 [true], 222 {"inserthtml":[false,false,"",false,false,""]}], 223 ["<a href=.>f[o]o</a>", 224 [["inserthtml","<a href=/>abc</a>"]], 225 "<a href=\".\">f</a><a href=\"/\">abc</a>{}<a href=\".\">o</a>", 226 [true], 227 {"inserthtml":[false,false,"",false,false,""]}], 228 ["<p>f[o]o", 229 [["defaultparagraphseparator","div"],["inserthtml","<hr>"]], 230 "<p>f</p><hr>{}<p>o</p>", 231 [true,true], 232 {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 233 ["<p>f[o]o", 234 [["defaultparagraphseparator","p"],["inserthtml","<hr>"]], 235 "<p>f</p><hr>{}<p>o</p>", 236 [true,true], 237 {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 238 ["<b>f[o]o</b>", 239 [["stylewithcss","true"],["inserthtml","<hr>"]], 240 "<b>f</b><hr>{}<b>o</b>", 241 [true,true], 242 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 243 ["<b>f[o]o</b>", 244 [["stylewithcss","false"],["inserthtml","<hr>"]], 245 "<b>f</b><hr>{}<b>o</b>", 246 [true,true], 247 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 248 ["<h1>f[o]o</h1>", 249 [["inserthtml","<h2>abc</h2>"]], 250 "<h1>f</h1><h2>abc</h2>{}<h1>o</h1>", 251 [true], 252 {"inserthtml":[false,false,"",false,false,""]}], 253 ["<table><tr><td>f[o]o</table>", 254 [["inserthtml","<td>abc</td>"]], 255 "<table><tbody><tr><td>fabc{}o</td></tr></tbody></table>", 256 [true], 257 {"inserthtml":[false,false,"",false,false,""]}], 258 ["f[o]o", 259 [["inserthtml","<td>abc</td>"]], 260 "fabc{}o", 261 [true], 262 {"inserthtml":[false,false,"",false,false,""]}], 263 ["<dl><dt>f[o]o<dd>bar</dl>", 264 [["inserthtml","<dt>abc</dt>"]], 265 "<dl><dt>f</dt><dt>abc</dt>{}<dt>o</dt><dd>bar</dd></dl>", 266 [true], 267 {"inserthtml":[false,false,"",false,false,""]}], 268 ["<dl><dt>foo<dd>b[a]r</dl>", 269 [["inserthtml","<dt>abc</dt>"]], 270 "<dl><dt>foo</dt><dd>b</dd><dt>abc</dt>{}<dd>r</dd></dl>", 271 [true], 272 {"inserthtml":[false,false,"",false,false,""]}], 273 ["<dl><dt>f[o]o<dd>bar</dl>", 274 [["inserthtml","<dd>abc</dd>"]], 275 "<dl><dt>f</dt><dd>abc</dd>{}<dt>o</dt><dd>bar</dd></dl>", 276 [true], 277 {"inserthtml":[false,false,"",false,false,""]}], 278 ["<dl><dt>foo<dd>b[a]r</dl>", 279 [["inserthtml","<dd>abc</dd>"]], 280 "<dl><dt>foo</dt><dd>b</dd><dd>abc</dd>{}<dd>r</dd></dl>", 281 [true], 282 {"inserthtml":[false,false,"",false,false,""]}], 283 ["f[o]o", 284 [["inserthtml","<dt>abc</dt>"]], 285 "f<dl><dt>abc</dt>{}</dl>o", 286 [true], 287 {"inserthtml":[false,false,"",false,false,""]}], 288 ["<ol><li>f[o]o</ol>", 289 [["inserthtml","<dt>abc</dt>"]], 290 "<ol><li>f<dl><dt>abc</dt>{}</dl>o</li></ol>", 291 [true], 292 {"inserthtml":[false,false,"",false,false,""]}], 293 ["f[o]o", 294 [["inserthtml","<dd>abc</dd>"]], 295 "f<dl><dd>abc</dd>{}</dl>o", 296 [true], 297 {"inserthtml":[false,false,"",false,false,""]}], 298 ["<ol><li>f[o]o</ol>", 299 [["inserthtml","<dd>abc</dd>"]], 300 "<ol><li>f<dl><dd>abc</dd>{}</dl>o</li></ol>", 301 [true], 302 {"inserthtml":[false,false,"",false,false,""]}], 303 ["<dir><li>f[o]o</dir>", 304 [["inserthtml","<li>abc</li>"]], 305 "<dir><li>f</li><li>abc</li>{}<li>o</li></dir>", 306 [true], 307 {"inserthtml":[false,false,"",false,false,""]}], 308 ["<ol><li>f[o]o</ol>", 309 [["inserthtml","<li>abc</li>"]], 310 "<ol><li>f</li><li>abc</li>{}<li>o</li></ol>", 311 [true], 312 {"inserthtml":[false,false,"",false,false,""]}], 313 ["<ul><li>f[o]o</ul>", 314 [["inserthtml","<li>abc</li>"]], 315 "<ul><li>f</li><li>abc</li>{}<li>o</li></ul>", 316 [true], 317 {"inserthtml":[false,false,"",false,false,""]}], 318 ["<dir><li>f[o]o</dir>", 319 [["inserthtml","<dir><li>abc</dir>"]], 320 "<dir><li>f<dir><li>abc</li></dir>{}o</li></dir>", 321 [true], 322 {"inserthtml":[false,false,"",false,false,""]}], 323 ["<ol><li>f[o]o</ol>", 324 [["inserthtml","<dir><li>abc</dir>"]], 325 "<ol><li>f<dir><li>abc</li></dir>{}o</li></ol>", 326 [true], 327 {"inserthtml":[false,false,"",false,false,""]}], 328 ["<ul><li>f[o]o</ul>", 329 [["inserthtml","<dir><li>abc</dir>"]], 330 "<ul><li>f<dir><li>abc</li></dir>{}o</li></ul>", 331 [true], 332 {"inserthtml":[false,false,"",false,false,""]}], 333 ["<dir><li>f[o]o</dir>", 334 [["inserthtml","<ol><li>abc</ol>"]], 335 "<dir><li>f<ol><li>abc</li></ol>{}o</li></dir>", 336 [true], 337 {"inserthtml":[false,false,"",false,false,""]}], 338 ["<ol><li>f[o]o</ol>", 339 [["inserthtml","<ol><li>abc</ol>"]], 340 "<ol><li>f<ol><li>abc</li></ol>{}o</li></ol>", 341 [true], 342 {"inserthtml":[false,false,"",false,false,""]}], 343 ["<ul><li>f[o]o</ul>", 344 [["inserthtml","<ol><li>abc</ol>"]], 345 "<ul><li>f<ol><li>abc</li></ol>{}o</li></ul>", 346 [true], 347 {"inserthtml":[false,false,"",false,false,""]}], 348 ["<dir><li>f[o]o</dir>", 349 [["inserthtml","<ul><li>abc</ul>"]], 350 "<dir><li>f<ul><li>abc</li></ul>{}o</li></dir>", 351 [true], 352 {"inserthtml":[false,false,"",false,false,""]}], 353 ["<ol><li>f[o]o</ol>", 354 [["inserthtml","<ul><li>abc</ul>"]], 355 "<ol><li>f<ul><li>abc</li></ul>{}o</li></ol>", 356 [true], 357 {"inserthtml":[false,false,"",false,false,""]}], 358 ["<ul><li>f[o]o</ul>", 359 [["inserthtml","<ul><li>abc</ul>"]], 360 "<ul><li>f<ul><li>abc</li></ul>{}o</li></ul>", 361 [true], 362 {"inserthtml":[false,false,"",false,false,""]}], 363 ["<ul id=\"old\"><li id=\"li0\">{}<br></ul>", 364 [["inserthtml","<ul id=\"new\"><li id=\"li1\">abc</li><li id=\"li2\">def</li></ul>"]], 365 "<ul id=\"old\"><li id=\"li1\">abc</li><li id=\"li2\">def</li></ul>", 366 [true], 367 {"inserthtml":[false,false,"",false,false,""]}], 368 ["<ol id=\"old\"><li id=\"li0\">{}<br></ol>", 369 [["inserthtml","<ol id=\"new\"><li id=\"li1\">abc</li><li id=\"li2\">def</li></ol>"]], 370 "<ol id=\"old\"><li id=\"li1\">abc</li><li id=\"li2\">def</li></ol>", 371 [true], 372 {"inserthtml":[false,false,"",false,false,""]}], 373 ["<ul id=\"old\"><li id=\"li0\">{}<br></ul>", 374 [["inserthtml","<ol id=\"new\"><li id=\"li1\">abc</li><li id=\"li2\">def</li></ol>"]], 375 "<ul id=\"old\"><li id=\"li1\">abc</li><li id=\"li2\">def</li></ul>", 376 [true], 377 {"inserthtml":[false,false,"",false,false,""]}], 378 ["<ol id=\"old\"><li id=\"li0\">{}<br></ol>", 379 [["inserthtml","<ul id=\"new\"><li id=\"li1\">abc</li><li id=\"li2\">def</li></ul>"]], 380 "<ol id=\"old\"><li id=\"li1\">abc</li><li id=\"li2\">def</li></ol>", 381 [true], 382 {"inserthtml":[false,false,"",false,false,""]}], 383 ["f[o]o", 384 [["defaultparagraphseparator","div"],["inserthtml","<li>abc</li>"]], 385 "f<div>abc</div>{}o", 386 [true,true], 387 {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 388 ["f[o]o", 389 [["defaultparagraphseparator","p"],["inserthtml","<li>abc</li>"]], 390 "f<p>abc</p>{}o", 391 [true,true], 392 {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 393 ["<nobr>f[o]o</nobr>", 394 [["inserthtml","<nobr>abc</nobr>"]], 395 "<nobr>f</nobr><nobr>abc</nobr>{}<nobr>o</nobr>", 396 [true], 397 {"inserthtml":[false,false,"",false,false,""]}], 398 ["f[o]o", 399 [["inserthtml","<nobr>abc</nobr>"]], 400 "f<nobr>abc</nobr>{}o", 401 [true], 402 {"inserthtml":[false,false,"",false,false,""]}], 403 ["<font color=blue>foo[]bar</font>", 404 [["stylewithcss","true"],["defaultparagraphseparator","div"],["inserthtml","<p>abc"]], 405 "<font color=\"blue\">foo</font><p><span style=\"color:rgb(0, 0, 255)\">abc</span></p>{}<font color=\"blue\">bar</font>", 406 [true,true,true], 407 {"stylewithcss":[false,false,"",false,true,""],"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 408 ["<font color=blue>foo[]bar</font>", 409 [["stylewithcss","false"],["defaultparagraphseparator","div"],["inserthtml","<p>abc"]], 410 "<font color=\"blue\">foo</font><p><font color=\"#0000ff\">abc</font></p>{}<font color=\"blue\">bar</font>", 411 [true,true,true], 412 {"stylewithcss":[false,true,"",false,false,""],"defaultparagraphseparator":[false,false,"div",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 413 ["<font color=blue>foo[]bar</font>", 414 [["stylewithcss","true"],["defaultparagraphseparator","p"],["inserthtml","<p>abc"]], 415 "<font color=\"blue\">foo</font><p><span style=\"color:rgb(0, 0, 255)\">abc</span></p>{}<font color=\"blue\">bar</font>", 416 [true,true,true], 417 {"stylewithcss":[false,false,"",false,true,""],"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 418 ["<font color=blue>foo[]bar</font>", 419 [["stylewithcss","false"],["defaultparagraphseparator","p"],["inserthtml","<p>abc"]], 420 "<font color=\"blue\">foo</font><p><font color=\"#0000ff\">abc</font></p>{}<font color=\"blue\">bar</font>", 421 [true,true,true], 422 {"stylewithcss":[false,true,"",false,false,""],"defaultparagraphseparator":[false,false,"p",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 423 ["<span style=color:blue>foo[]bar</span>", 424 [["stylewithcss","true"],["defaultparagraphseparator","div"],["inserthtml","<p>abc"]], 425 "<span style=\"color:rgb(0, 0, 255)\">foo</span><p><span style=\"color:rgb(0, 0, 255)\">abc</span></p>{}<span style=\"color:rgb(0, 0, 255)\">bar</span>", 426 [true,true,true], 427 {"stylewithcss":[false,false,"",false,true,""],"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 428 ["<span style=color:blue>foo[]bar</span>", 429 [["stylewithcss","false"],["defaultparagraphseparator","div"],["inserthtml","<p>abc"]], 430 "<span style=\"color:rgb(0, 0, 255)\">foo</span><p><font color=\"#0000ff\">abc</font></p>{}<span style=\"color:rgb(0, 0, 255)\">bar</span>", 431 [true,true,true], 432 {"stylewithcss":[false,true,"",false,false,""],"defaultparagraphseparator":[false,false,"div",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 433 ["<span style=color:blue>foo[]bar</span>", 434 [["stylewithcss","true"],["defaultparagraphseparator","p"],["inserthtml","<p>abc"]], 435 "<span style=\"color:rgb(0, 0, 255)\">foo</span><p><span style=\"color:rgb(0, 0, 255)\">abc</span></p>{}<span style=\"color:rgb(0, 0, 255)\">bar</span>", 436 [true,true,true], 437 {"stylewithcss":[false,false,"",false,true,""],"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 438 ["<span style=color:blue>foo[]bar</span>", 439 [["stylewithcss","false"],["defaultparagraphseparator","p"],["inserthtml","<p>abc"]], 440 "<span style=\"color:rgb(0, 0, 255)\">foo</span><p><font color=\"#0000ff\">abc</font></p>{}<span style=\"color:rgb(0, 0, 255)\">bar</span>", 441 [true,true,true], 442 {"stylewithcss":[false,true,"",false,false,""],"defaultparagraphseparator":[false,false,"p",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 443 ["<span style=font-variant:small-caps>foo[]bar</span>", 444 [["stylewithcss","true"],["defaultparagraphseparator","div"],["inserthtml","<p>abc"]], 445 "<span style=\"font-variant:small-caps\">foo</span><p>abc</p>{}<span style=\"font-variant:small-caps\">bar</span>", 446 [true,true,true], 447 {"stylewithcss":[false,false,"",false,true,""],"defaultparagraphseparator":[false,false,"p",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 448 ["<span style=font-variant:small-caps>foo[]bar</span>", 449 [["stylewithcss","false"],["defaultparagraphseparator","div"],["inserthtml","<p>abc"]], 450 "<span style=\"font-variant:small-caps\">foo</span><p>abc</p>{}<span style=\"font-variant:small-caps\">bar</span>", 451 [true,true,true], 452 {"stylewithcss":[false,true,"",false,false,""],"defaultparagraphseparator":[false,false,"div",false,false,"div"],"inserthtml":[false,false,"",false,false,""]}], 453 ["<span style=font-variant:small-caps>foo[]bar</span>", 454 [["stylewithcss","true"],["defaultparagraphseparator","p"],["inserthtml","<p>abc"]], 455 "<span style=\"font-variant:small-caps\">foo</span><p>abc</p>{}<span style=\"font-variant:small-caps\">bar</span>", 456 [true,true,true], 457 {"stylewithcss":[false,false,"",false,true,""],"defaultparagraphseparator":[false,false,"div",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 458 ["<span style=font-variant:small-caps>foo[]bar</span>", 459 [["stylewithcss","false"],["defaultparagraphseparator","p"],["inserthtml","<p>abc"]], 460 "<span style=\"font-variant:small-caps\">foo</span><p>abc</p>{}<span style=\"font-variant:small-caps\">bar</span>", 461 [true,true,true], 462 {"stylewithcss":[false,true,"",false,false,""],"defaultparagraphseparator":[false,false,"p",false,false,"p"],"inserthtml":[false,false,"",false,false,""]}], 463 ["<p>[foo]</p>", 464 [["inserthtml"," "]], 465 "<p> {}<br></p>", 466 [true], 467 {"inserthtml":[false,false,"",false,false,""]}], 468 ["<p>[foo]</p>", 469 [["stylewithcss","true"],["inserthtml","<span style=display:none></span>"]], 470 "<p><span style=\"display:none\"></span>{}</p>", 471 [true,true], 472 {"stylewithcss":[false,false,"",false,true,""],"inserthtml":[false,false,"",false,false,""]}], 473 ["<p>[foo]</p>", 474 [["stylewithcss","false"],["inserthtml","<span style=display:none></span>"]], 475 "<p><span style=\"display:none\"></span>{}</p>", 476 [true,true], 477 {"stylewithcss":[false,true,"",false,false,""],"inserthtml":[false,false,"",false,false,""]}], 478 ["<p>[foo]</p>", 479 [["inserthtml","<!--abc-->"]], 480 "<p><!--abc--><br></p>", 481 [true], 482 {"inserthtml":[false,false,"",false,false,""]}], 483 ["<p>{}<br></p>", 484 [["inserthtml","abc"]], 485 "<p>abc{}</p>", 486 [true], 487 {"inserthtml":[false,false,"",false,false,""]}], 488 ["<p>{}<br></p>", 489 [["inserthtml","<!--abc-->"]], 490 "<p><!--abc--><br></p>", 491 [true], 492 {"inserthtml":[false,false,"",false,false,""]}], 493 ["<p><!--foo-->{}<span><br></span><!--bar--></p>", 494 [["inserthtml","abc"]], 495 "<p><!--foo-->abc{}<!--bar--></p>", 496 [true], 497 {"inserthtml":[false,false,"",false,false,""]}], 498 ["<p><!--foo-->{}<span><br></span><!--bar--></p>", 499 [["inserthtml","<!--abc-->"]], 500 "<p><!--foo--><!--abc-->{}<!--bar--><br></p>", 501 [true], 502 {"inserthtml":[false,false,"",false,false,""]}], 503 ["<p>{}<span><!--foo--><br><!--bar--></span></p>", 504 [["inserthtml","abc"]], 505 "<p>abc{}</p>", 506 [true], 507 {"inserthtml":[false,false,"",false,false,""]}], 508 ["<p>{}<span><!--foo--><br><!--bar--></span></p>", 509 [["inserthtml","<!--abc-->"]], 510 "<p><!--abc-->{}<br></p>", 511 [true], 512 {"inserthtml":[false,false,"",false,false,""]}], 513 514 // When selection is collapsed after an invisible <br> element, content should 515 // be inserted before it because inserting something after the <br> element 516 // makes the element visible. 517 ["<p><br>{}</p>", 518 [["inserthtml","abc"]], 519 "<p>abc</p>", 520 [true], 521 {"inserthtml":[false,false,"",false,false,""]}], 522 ["<p><br>{}</p>", 523 [["inserthtml","<!--abc-->"]], 524 ["<p><br><!--abc--></p>", 525 "<p><!--abc--><br></p>"], 526 [true], 527 {"inserthtml":[false,false,"",false,false,""]}], 528 ["<p><!--foo--><span><br></span>{}<!--bar--></p>", 529 [["inserthtml","abc"]], 530 ["<p><!--foo--><span>abc</span><!--bar--></p>", 531 "<p><!--foo-->abc<!--bar--></p>"], 532 [true], 533 {"inserthtml":[false,false,"",false,false,""]}], 534 ["<p><!--foo--><span><br></span>{}<!--bar--></p>", 535 [["inserthtml","<!--abc-->"]], 536 "<p><!--foo--><span><!--abc-->{}<br></span><!--bar--></p>", 537 [true], 538 {"inserthtml":[false,false,"",false,false,""]}], 539 // Don't insert text after the invisible <br> element. In the normal cases 540 // (meaning without the Comment nodes), caret should be put at the <br>. 541 // Therefore, inserting text should be done before the <br>. Then, the <br> 542 // becomes unnecessary so that it should be removed. 543 ["<p><span><!--foo--><br><!--bar--></span>{}</p>", 544 [["inserthtml","abc"]], 545 "<p><span><!--foo-->abc<!--bar--></span></p>", 546 [true], 547 {"inserthtml":[false,false,"",false,false,""]}], 548 // It may be allowed to insert new Comment after the invisible <br> element. 549 // Therefore, the first one expects the new position as same as the `Selection`. 550 // On the other hand, if the inserting content includes visible things, 551 // everything should be inserted before the invisible <br>. Therefore, the 552 // new position can be before the <br> as same as handled as inserting visible 553 // things. 554 ["<p><span><!--foo--><br><!--bar--></span>{}</p>", 555 [["inserthtml","<!--abc-->"]], 556 ["<p><span><!--foo--><br><!--bar--></span><!--abc--></p>", 557 "<p><span><!--foo--><!--abc--><br><!--bar--></span></p>"], 558 [true], 559 {"inserthtml":[false,false,"",false,false,""]}], 560 561 ["<pre>12[]34</pre>", 562 [["inserthtml","<pre>abc</pre>"]], 563 "<pre>12abc34</pre>", 564 [true], 565 {"inserthtml":[false,false,"",false,false,""]}], 566 ["<pre>1[23]4</pre>", 567 [["inserthtml","<pre>abc</pre>"]], 568 "<pre>1abc4</pre>", 569 [true], 570 {"inserthtml":[false,false,"",false,false,""]}], 571 ["<pre>[1234]</pre>", 572 [["inserthtml","<pre>abc</pre>"]], 573 "<pre>abc</pre>", 574 [true], 575 {"inserthtml":[false,false,"",false,false,""]}], 576 ["<pre contenteditable=\"false\"><span contenteditable>[1234]</span></pre>", 577 [["inserthtml","<pre>abc</pre>"]], 578 ["<pre contenteditable=\"false\"><span contenteditable=\"\">abc</span></pre>", 579 "<pre contenteditable=\"false\"><span contenteditable=\"\">abc</span></pre>"], 580 [true], 581 {"inserthtml":[false,false,"",false,false,""]}], 582 583 // Empty inline elements shouldn't be deleted if they are inserted intentionally 584 ["<div>a[]b</div>", 585 [["inserthtml","<span></span>"]], 586 ["<div>a<span></span>b</div>","<div>a<span></span>b<br></div>"], 587 [true], 588 {"inserthtml":[false,false,"",false,false,""]}], 589 ["<div>a[]c</div>", 590 [["inserthtml","<span class=\"s1\"></span>b<span class=\"s2\"></span>"]], 591 ["<div>a<span class=\"s1\"></span>b<span class=\"s2\"></span>c</div>", 592 "<div>a<span class=\"s1\"></span>b<span class=\"s2\"></span>c<br></div>"], 593 [true], 594 {"inserthtml":[false,false,"",false,false,""]}], 595 ["{}", 596 [["inserthtml","<div class=\"d1\"></div><div class=\"d2\"><span class=\"s1\">some text</span><a href=\"foo.html\"></a></div>"]], 597 "<div class=\"d1\"></div><div class=\"d2\"><span class=\"s1\">some text</span><a href=\"foo.html\"></a></div>", 598 [true], 599 {"inserthtml":[false,false,"",false,false,""]}], 600 601 // Do not delete non-editable when clearing the original style 602 ["<p><b>[X]<span contenteditable=false>abc</span></b><i>def</i></p>", 603 [["inserthtml","<i>Z</i>"]], 604 "<p><i>Z</i><b><span contenteditable=\"false\">abc</span></b><i>def</i></p>", 605 [true], 606 {}], 607 ["<p><b><span contenteditable=false>abc</span>[Y]</b><i>def</i></p>", 608 [["inserthtml","<i>Z</i>"]], 609 ["<p><b><span contenteditable=\"false\">abc</span></b><i>Z</i><i>def</i></p>", 610 "<p><b><span contenteditable=\"false\">abc</span></b><i>Zdef</i></p>"], 611 [true], 612 {}], 613 ]