Improve handling of invisible nodes
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Wed, 21 Sep 2011 14:29:54 -0600
changeset 614 ee2791b98b92
parent 613 d91d1ebb3394
child 615 b679aa3a13f0
Improve handling of invisible nodes

The required changes were amazingly non-invasive, since so much is
centralized in the wrap algorithm.

Fixes: http://www.w3.org/Bugs/Public/show_bug.cgi?id=13811
Fixes: http://www.w3.org/Bugs/Public/show_bug.cgi?id=14231
conformancetest/data.js
editing.html
implementation.js
source.html
tests.js
--- a/conformancetest/data.js	Wed Sep 21 11:53:03 2011 -0600
+++ b/conformancetest/data.js	Wed Sep 21 14:29:54 2011 -0600
@@ -25,11 +25,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["backcolor","#00FFFF"]],
-	"<p><span style=\"background-color:rgb(0, 255, 255)\">[foo</span></p><p> <span style=\"background-color:rgb(0, 255, 255)\"><span>bar</span> </span></p><p><span style=\"background-color:rgb(0, 255, 255)\">baz]</span></p>",
+	"<p><span style=\"background-color:rgb(0, 255, 255)\">[foo</span></p><p> <span style=\"background-color:rgb(0, 255, 255)\"><span>bar</span></span> </p><p><span style=\"background-color:rgb(0, 255, 255)\">baz]</span></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["backcolor","#00FFFF"]],
-	"<p><span style=\"background-color:rgb(0, 255, 255)\">[foo</span></p><p> <span style=\"background-color:rgb(0, 255, 255)\"><span>bar</span> </span></p><p><span style=\"background-color:rgb(0, 255, 255)\">baz]</span></p>",
+	"<p><span style=\"background-color:rgb(0, 255, 255)\">[foo</span></p><p> <span style=\"background-color:rgb(0, 255, 255)\"><span>bar</span></span> </p><p><span style=\"background-color:rgb(0, 255, 255)\">baz]</span></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["backcolor","#00FFFF"]],
@@ -353,11 +353,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"bold":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["bold",""]],
-	"<p><b>[foo</b></p><p> <b><span>bar</span> </b></p><p><b>baz]</b></p>",
+	"<p><b>[foo</b></p><p> <b><span>bar</span></b> </p><p><b>baz]</b></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"bold":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["bold",""]],
-	"<p><span style=\"font-weight:bold\">[foo</span></p><p> <span style=\"font-weight:bold\"><span>bar</span> </span></p><p><span style=\"font-weight:bold\">baz]</span></p>",
+	"<p><span style=\"font-weight:bold\">[foo</span></p><p> <span style=\"font-weight:bold\"><span>bar</span></span> </p><p><span style=\"font-weight:bold\">baz]</span></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"bold":[false,false,"",false,true,""]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["bold",""]],
@@ -1329,11 +1329,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"createlink":[false,false,"",false,false,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["createlink","http://www.google.com/"]],
-	"<p><a href=\"http://www.google.com/\">[foo</a></p><p> <a href=\"http://www.google.com/\"><span>bar</span> </a></p><p><a href=\"http://www.google.com/\">baz]</a></p>",
+	"<p><a href=\"http://www.google.com/\">[foo</a></p><p> <a href=\"http://www.google.com/\"><span>bar</span></a> </p><p><a href=\"http://www.google.com/\">baz]</a></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"createlink":[false,false,"",false,false,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["createlink","http://www.google.com/"]],
-	"<p><a href=\"http://www.google.com/\">[foo</a></p><p> <a href=\"http://www.google.com/\"><span>bar</span> </a></p><p><a href=\"http://www.google.com/\">baz]</a></p>",
+	"<p><a href=\"http://www.google.com/\">[foo</a></p><p> <a href=\"http://www.google.com/\"><span>bar</span></a> </p><p><a href=\"http://www.google.com/\">baz]</a></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"createlink":[false,false,"",false,false,""]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["createlink","http://www.google.com/"]],
@@ -3905,11 +3905,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["fontname","sans-serif"]],
-	"<p><font face=\"sans-serif\">[foo</font></p><p> <font face=\"sans-serif\"><span>bar</span> </font></p><p><font face=\"sans-serif\">baz]</font></p>",
+	"<p><font face=\"sans-serif\">[foo</font></p><p> <font face=\"sans-serif\"><span>bar</span></font> </p><p><font face=\"sans-serif\">baz]</font></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["fontname","sans-serif"]],
-	"<p><span style=\"font-family:sans-serif\">[foo</span></p><p> <span style=\"font-family:sans-serif\"><span>bar</span> </span></p><p><span style=\"font-family:sans-serif\">baz]</span></p>",
+	"<p><span style=\"font-family:sans-serif\">[foo</span></p><p> <span style=\"font-family:sans-serif\"><span>bar</span></span> </p><p><span style=\"font-family:sans-serif\">baz]</span></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["fontname","sans-serif"]],
@@ -4497,11 +4497,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["fontsize","4"]],
-	"<p><font size=\"4\">[foo</font></p><p> <font size=\"4\"><span>bar</span> </font></p><p><font size=\"4\">baz]</font></p>",
+	"<p><font size=\"4\">[foo</font></p><p> <font size=\"4\"><span>bar</span></font> </p><p><font size=\"4\">baz]</font></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["fontsize","4"]],
-	"<p><span style=\"font-size:large\">[foo</span></p><p> <span style=\"font-size:large\"><span>bar</span> </span></p><p><span style=\"font-size:large\">baz]</span></p>",
+	"<p><span style=\"font-size:large\">[foo</span></p><p> <span style=\"font-size:large\"><span>bar</span></span> </p><p><span style=\"font-size:large\">baz]</span></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["fontsize","4"]],
@@ -5185,11 +5185,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["forecolor","#0000FF"]],
-	"<p><font color=\"#0000ff\">[foo</font></p><p> <font color=\"#0000ff\"><span>bar</span> </font></p><p><font color=\"#0000ff\">baz]</font></p>",
+	"<p><font color=\"#0000ff\">[foo</font></p><p> <font color=\"#0000ff\"><span>bar</span></font> </p><p><font color=\"#0000ff\">baz]</font></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["forecolor","#0000FF"]],
-	"<p><span style=\"color:rgb(0, 0, 255)\">[foo</span></p><p> <span style=\"color:rgb(0, 0, 255)\"><span>bar</span> </span></p><p><span style=\"color:rgb(0, 0, 255)\">baz]</span></p>",
+	"<p><span style=\"color:rgb(0, 0, 255)\">[foo</span></p><p> <span style=\"color:rgb(0, 0, 255)\"><span>bar</span></span> </p><p><span style=\"color:rgb(0, 0, 255)\">baz]</span></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["forecolor","#0000FF"]],
@@ -5841,11 +5841,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"formatblock":[false,false,"",false,false,"div"]}],
 ["{<p><p> <p>foo</p>}",
 	[["stylewithcss","false"],["formatblock","<div>"]],
-	"<div>{ </div><div>foo}</div>",
+	"<div>{ foo}</div>",
 	{"stylewithcss":[false,true,"",false,false,""],"formatblock":[false,false,"p",false,false,"div"]}],
 ["{<p><p> <p>foo</p>}",
 	[["stylewithcss","true"],["formatblock","<div>"]],
-	"<div>{ </div><div>foo}</div>",
+	"<div>{ foo}</div>",
 	{"stylewithcss":[false,false,"",false,true,""],"formatblock":[false,false,"p",false,false,"div"]}],
 ["foo[bar<i>baz]qoz</i>quz<p>extra",
 	[["stylewithcss","false"],["formatblock","<div>"]],
@@ -6113,11 +6113,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"formatblock":[false,false,"",false,false,"p"]}],
 ["{<p><p> <p>foo</p>}",
 	[["stylewithcss","false"],["formatblock","<p>"]],
-	"<p>{ </p><p>foo}</p>",
+	"<p>{ foo}</p>",
 	{"stylewithcss":[false,true,"",false,false,""],"formatblock":[false,false,"p",false,false,"p"]}],
 ["{<p><p> <p>foo</p>}",
 	[["stylewithcss","true"],["formatblock","<p>"]],
-	"<p>{ </p><p>foo}</p>",
+	"<p>{ foo}</p>",
 	{"stylewithcss":[false,false,"",false,true,""],"formatblock":[false,false,"p",false,false,"p"]}],
 ["foo[bar<i>baz]qoz</i>quz<p>extra",
 	[["stylewithcss","false"],["formatblock","<p>"]],
@@ -9793,11 +9793,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["hilitecolor","#00FFFF"]],
-	"<p><span style=\"background-color:rgb(0, 255, 255)\">[foo</span></p><p> <span style=\"background-color:rgb(0, 255, 255)\"><span>bar</span> </span></p><p><span style=\"background-color:rgb(0, 255, 255)\">baz]</span></p>",
+	"<p><span style=\"background-color:rgb(0, 255, 255)\">[foo</span></p><p> <span style=\"background-color:rgb(0, 255, 255)\"><span>bar</span></span> </p><p><span style=\"background-color:rgb(0, 255, 255)\">baz]</span></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["hilitecolor","#00FFFF"]],
-	"<p><span style=\"background-color:rgb(0, 255, 255)\">[foo</span></p><p> <span style=\"background-color:rgb(0, 255, 255)\"><span>bar</span> </span></p><p><span style=\"background-color:rgb(0, 255, 255)\">baz]</span></p>",
+	"<p><span style=\"background-color:rgb(0, 255, 255)\">[foo</span></p><p> <span style=\"background-color:rgb(0, 255, 255)\"><span>bar</span></span> </p><p><span style=\"background-color:rgb(0, 255, 255)\">baz]</span></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["hilitecolor","#00FFFF"]],
@@ -11151,6 +11151,126 @@
 	[["stylewithcss","true"],["indent",""]],
 	"<blockquote><p>{}<!--foo-->bar</p></blockquote><p>extra</p>",
 	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<blockquote><p>foo</blockquote> <p>[bar]",
+	[["stylewithcss","false"],["indent",""]],
+	"<blockquote><p>foo</p> <p>[bar]</p></blockquote>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<blockquote><p>foo</blockquote> <p>[bar]",
+	[["stylewithcss","true"],["indent",""]],
+	"<blockquote><p>foo</p> <p>[bar]</p></blockquote>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<p>[foo]</p> <blockquote><p>bar</blockquote>",
+	[["stylewithcss","false"],["indent",""]],
+	"<blockquote><p>[foo]</p> <p>bar</p></blockquote>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<p>[foo]</p> <blockquote><p>bar</blockquote>",
+	[["stylewithcss","true"],["indent",""]],
+	"<blockquote><p>[foo]</p> <p>bar</p></blockquote>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<blockquote><p>foo</blockquote> <p>[bar]</p> <blockquote><p>baz</blockquote>",
+	[["stylewithcss","false"],["indent",""]],
+	"<blockquote><p>foo</p> <p>[bar]</p> <p>baz</p></blockquote>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<blockquote><p>foo</blockquote> <p>[bar]</p> <blockquote><p>baz</blockquote>",
+	[["stylewithcss","true"],["indent",""]],
+	"<blockquote><p>foo</p> <p>[bar]</p> <p>baz</p></blockquote>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo</li><ol><li>bar</li> </ol><li>[baz]</ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li> <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo</li><ol><li>bar</li> </ol><li>[baz]</ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li> <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo</li><ol><li>bar</li></ol> <li>[baz]</ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li> <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo</li><ol><li>bar</li></ol> <li>[baz]</ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li> <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo</li><ol><li>bar</li> </ol> <li>[baz]</ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li>  <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo</li><ol><li>bar</li> </ol> <li>[baz]</ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li>  <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<ol><li>bar</li> </ol></li><li>[baz]</ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li> <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<ol><li>bar</li> </ol></li><li>[baz]</ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li> <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<ol><li>bar</li></ol></li> <li>[baz]</ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li> <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<ol><li>bar</li></ol></li> <li>[baz]</ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li> <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<ol><li>bar</li> </ol></li> <li>[baz]</ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li>  <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<ol><li>bar</li> </ol></li> <li>[baz]</ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>bar</li>  <li>[baz]</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar]</li> <ol><li>baz</ol></ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar]</li> <li>baz</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar]</li> <ol><li>baz</ol></ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar]</li> <li>baz</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar]</li><ol> <li>baz</ol></ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar]</li> <li>baz</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar]</li><ol> <li>baz</ol></ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar]</li> <li>baz</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar]</li> <ol> <li>baz</ol></ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar]</li>  <li>baz</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar]</li> <ol> <li>baz</ol></ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar]</li>  <li>baz</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar] <ol><li>baz</ol></ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar] </li><li>baz</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar] <ol><li>baz</ol></ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar] </li><li>baz</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar]<ol> <li>baz</ol></ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar]</li> <li>baz</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar]<ol> <li>baz</ol></ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar]</li> <li>baz</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar] <ol> <li>baz</ol></ol>",
+	[["stylewithcss","false"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar] </li> <li>baz</li></ol></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"indent":[false,false,"",false,false,""]}],
+["<ol><li>foo<li>[bar] <ol> <li>baz</ol></ol>",
+	[["stylewithcss","true"],["indent",""]],
+	"<ol><li>foo</li><ol><li>[bar] </li> <li>baz</li></ol></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"indent":[false,false,"",false,false,""]}],
 ["<ul><li>a<br>{<br>}</li><li>b</li></ul>",
 	[["stylewithcss","false"],["indent",""]],
 	"<ul><ul><li>a<br>{<br>}</li></ul><li>b</li></ul>",
@@ -14615,6 +14735,30 @@
 	[["stylewithcss","true"],["insertorderedlist",""]],
 	"<ul style=\"text-indent:1em\"><li>foo</li><li>bar</li></ul><ol><li>[baz]</li></ol>",
 	{"stylewithcss":[false,false,"",false,true,""],"insertorderedlist":[false,false,"",false,true,""]}],
+["<ol><li>foo</ol> <p>[bar]",
+	[["stylewithcss","false"],["insertorderedlist",""]],
+	"<ol><li>foo</li> <li>[bar]</li></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"insertorderedlist":[false,false,"",false,true,""]}],
+["<ol><li>foo</ol> <p>[bar]",
+	[["stylewithcss","true"],["insertorderedlist",""]],
+	"<ol><li>foo</li> <li>[bar]</li></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"insertorderedlist":[false,false,"",false,true,""]}],
+["<p>[foo]</p> <ol><li>bar</ol>",
+	[["stylewithcss","false"],["insertorderedlist",""]],
+	"<ol><li>[foo]</li> <li>bar</li></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"insertorderedlist":[false,false,"",false,true,""]}],
+["<p>[foo]</p> <ol><li>bar</ol>",
+	[["stylewithcss","true"],["insertorderedlist",""]],
+	"<ol><li>[foo]</li> <li>bar</li></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"insertorderedlist":[false,false,"",false,true,""]}],
+["<ol><li>foo</ol> <p>[bar]</p> <ol><li>baz</ol>",
+	[["stylewithcss","false"],["insertorderedlist",""]],
+	"<ol><li>foo</li> <li>[bar]</li> <li>baz</li></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"insertorderedlist":[false,false,"",false,true,""]}],
+["<ol><li>foo</ol> <p>[bar]</p> <ol><li>baz</ol>",
+	[["stylewithcss","true"],["insertorderedlist",""]],
+	"<ol><li>foo</li> <li>[bar]</li> <li>baz</li></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"insertorderedlist":[false,false,"",false,true,""]}],
 ["foo[bar]baz",
 	[["stylewithcss","false"],["insertparagraph",""]],
 	"<p>foo</p><p>{}baz</p>",
@@ -17511,6 +17655,30 @@
 	[["stylewithcss","true"],["insertunorderedlist",""]],
 	"<ul style=\"text-indent:1em\"><li>foo</li><li>bar</li></ul><p>[baz]</p>",
 	{"stylewithcss":[false,false,"",false,true,""],"insertunorderedlist":[false,true,"",false,false,""]}],
+["<ul><li>foo</ul> <p>[bar]",
+	[["stylewithcss","false"],["insertunorderedlist",""]],
+	"<ul><li>foo</li> <li>[bar]</li></ul>",
+	{"stylewithcss":[false,true,"",false,false,""],"insertunorderedlist":[false,false,"",false,true,""]}],
+["<ul><li>foo</ul> <p>[bar]",
+	[["stylewithcss","true"],["insertunorderedlist",""]],
+	"<ul><li>foo</li> <li>[bar]</li></ul>",
+	{"stylewithcss":[false,false,"",false,true,""],"insertunorderedlist":[false,false,"",false,true,""]}],
+["<p>[foo]</p> <ul><li>bar</ul>",
+	[["stylewithcss","false"],["insertunorderedlist",""]],
+	"<ul><li>[foo]</li> <li>bar</li></ul>",
+	{"stylewithcss":[false,true,"",false,false,""],"insertunorderedlist":[false,false,"",false,true,""]}],
+["<p>[foo]</p> <ul><li>bar</ul>",
+	[["stylewithcss","true"],["insertunorderedlist",""]],
+	"<ul><li>[foo]</li> <li>bar</li></ul>",
+	{"stylewithcss":[false,false,"",false,true,""],"insertunorderedlist":[false,false,"",false,true,""]}],
+["<ul><li>foo</ul> <p>[bar]</p> <ul><li>baz</ul>",
+	[["stylewithcss","false"],["insertunorderedlist",""]],
+	"<ul><li>foo</li> <li>[bar]</li> <li>baz</li></ul>",
+	{"stylewithcss":[false,true,"",false,false,""],"insertunorderedlist":[false,false,"",false,true,""]}],
+["<ul><li>foo</ul> <p>[bar]</p> <ul><li>baz</ul>",
+	[["stylewithcss","true"],["insertunorderedlist",""]],
+	"<ul><li>foo</li> <li>[bar]</li> <li>baz</li></ul>",
+	{"stylewithcss":[false,false,"",false,true,""],"insertunorderedlist":[false,false,"",false,true,""]}],
 ["{<div style=\"font-size: 1.3em\">1</div><div style=\"font-size: 1.1em\">2</div>}",
 	[["stylewithcss","false"],["insertunorderedlist",""]],
 	"<ul>{<li style=\"font-size:1.3em\">1</li><li style=\"font-size:1.1em\">2</li>}</ul>",
@@ -17545,11 +17713,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"italic":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["italic",""]],
-	"<p><i>[foo</i></p><p> <i><span>bar</span> </i></p><p><i>baz]</i></p>",
+	"<p><i>[foo</i></p><p> <i><span>bar</span></i> </p><p><i>baz]</i></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"italic":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["italic",""]],
-	"<p><span style=\"font-style:italic\">[foo</span></p><p> <span style=\"font-style:italic\"><span>bar</span> </span></p><p><span style=\"font-style:italic\">baz]</span></p>",
+	"<p><span style=\"font-style:italic\">[foo</span></p><p> <span style=\"font-style:italic\"><span>bar</span></span> </p><p><span style=\"font-style:italic\">baz]</span></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"italic":[false,false,"",false,true,""]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["italic",""]],
@@ -18887,6 +19055,78 @@
 	[["stylewithcss","true"],["justifycenter",""]],
 	"<div style=\"text-align:center\"><div dir=\"rtl\">[foo]</div></div><p>extra</p>",
 	{"stylewithcss":[false,false,"",false,true,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<div style=text-align:center><p>foo</div> <p>[bar]",
+	[["stylewithcss","false"],["justifycenter",""]],
+	"<div style=\"text-align:center\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<div style=text-align:center><p>foo</div> <p>[bar]",
+	[["stylewithcss","true"],["justifycenter",""]],
+	"<div style=\"text-align:center\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<div align=center><p>foo</div> <p>[bar]",
+	[["stylewithcss","false"],["justifycenter",""]],
+	"<div align=\"center\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<div align=center><p>foo</div> <p>[bar]",
+	[["stylewithcss","true"],["justifycenter",""]],
+	"<div align=\"center\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<center><p>foo</center> <p>[bar]",
+	[["stylewithcss","false"],["justifycenter",""]],
+	"<center><p>foo</p></center><div style=\"text-align:center\"> <p>[bar]</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<center><p>foo</center> <p>[bar]",
+	[["stylewithcss","true"],["justifycenter",""]],
+	"<center><p>foo</p></center><div style=\"text-align:center\"> <p>[bar]</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<p>[foo]</p> <div style=text-align:center><p>bar</div>",
+	[["stylewithcss","false"],["justifycenter",""]],
+	"<div style=\"text-align:center\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<p>[foo]</p> <div style=text-align:center><p>bar</div>",
+	[["stylewithcss","true"],["justifycenter",""]],
+	"<div style=\"text-align:center\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<p>[foo]</p> <div align=center><p>bar</div>",
+	[["stylewithcss","false"],["justifycenter",""]],
+	"<div align=\"center\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<p>[foo]</p> <div align=center><p>bar</div>",
+	[["stylewithcss","true"],["justifycenter",""]],
+	"<div align=\"center\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<p>[foo]</p> <center><p>bar</center>",
+	[["stylewithcss","false"],["justifycenter",""]],
+	"<div style=\"text-align:center\"><p>[foo]</p> </div><center><p>bar</p></center>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<p>[foo]</p> <center><p>bar</center>",
+	[["stylewithcss","true"],["justifycenter",""]],
+	"<div style=\"text-align:center\"><p>[foo]</p> </div><center><p>bar</p></center>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<div style=text-align:center><p>foo</div> <p>[bar]</p> <div style=text-align:center><p>baz</div>",
+	[["stylewithcss","false"],["justifycenter",""]],
+	"<div style=\"text-align:center\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<div style=text-align:center><p>foo</div> <p>[bar]</p> <div style=text-align:center><p>baz</div>",
+	[["stylewithcss","true"],["justifycenter",""]],
+	"<div style=\"text-align:center\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<div align=center><p>foo</div> <p>[bar]</p> <div align=center><p>baz</div>",
+	[["stylewithcss","false"],["justifycenter",""]],
+	"<div align=\"center\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<div align=center><p>foo</div> <p>[bar]</p> <div align=center><p>baz</div>",
+	[["stylewithcss","true"],["justifycenter",""]],
+	"<div align=\"center\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<center><p>foo</center> <p>[bar]</p> <center><p>baz</center>",
+	[["stylewithcss","false"],["justifycenter",""]],
+	"<center><p>foo</p></center><div style=\"text-align:center\"> <p>[bar]</p> </div><center><p>baz</p></center>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifycenter":[false,false,"left",false,true,"center"]}],
+["<center><p>foo</center> <p>[bar]</p> <center><p>baz</center>",
+	[["stylewithcss","true"],["justifycenter",""]],
+	"<center><p>foo</p></center><div style=\"text-align:center\"> <p>[bar]</p> </div><center><p>baz</p></center>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifycenter":[false,false,"left",false,true,"center"]}],
 ["foo[]bar<p>extra",
 	[["stylewithcss","false"],["justifyfull",""]],
 	"<div style=\"text-align:justify\">foo[]bar</div><p>extra</p>",
@@ -19535,6 +19775,54 @@
 	[["stylewithcss","true"],["justifyfull",""]],
 	"<div style=\"text-align:justify\"><div dir=\"rtl\">[foo]</div></div><p>extra</p>",
 	{"stylewithcss":[false,false,"",false,true,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<div style=text-align:justify><p>foo</div> <p>[bar]",
+	[["stylewithcss","false"],["justifyfull",""]],
+	"<div style=\"text-align:justify\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<div style=text-align:justify><p>foo</div> <p>[bar]",
+	[["stylewithcss","true"],["justifyfull",""]],
+	"<div style=\"text-align:justify\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<div align=justify><p>foo</div> <p>[bar]",
+	[["stylewithcss","false"],["justifyfull",""]],
+	"<div align=\"justify\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<div align=justify><p>foo</div> <p>[bar]",
+	[["stylewithcss","true"],["justifyfull",""]],
+	"<div align=\"justify\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<p>[foo]</p> <div style=text-align:justify><p>bar</div>",
+	[["stylewithcss","false"],["justifyfull",""]],
+	"<div style=\"text-align:justify\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<p>[foo]</p> <div style=text-align:justify><p>bar</div>",
+	[["stylewithcss","true"],["justifyfull",""]],
+	"<div style=\"text-align:justify\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<p>[foo]</p> <div align=justify><p>bar</div>",
+	[["stylewithcss","false"],["justifyfull",""]],
+	"<div align=\"justify\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<p>[foo]</p> <div align=justify><p>bar</div>",
+	[["stylewithcss","true"],["justifyfull",""]],
+	"<div align=\"justify\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<div style=text-align:justify><p>foo</div> <p>[bar]</p> <div style=text-align:justify><p>baz</div>",
+	[["stylewithcss","false"],["justifyfull",""]],
+	"<div style=\"text-align:justify\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<div style=text-align:justify><p>foo</div> <p>[bar]</p> <div style=text-align:justify><p>baz</div>",
+	[["stylewithcss","true"],["justifyfull",""]],
+	"<div style=\"text-align:justify\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<div align=justify><p>foo</div> <p>[bar]</p> <div align=justify><p>baz</div>",
+	[["stylewithcss","false"],["justifyfull",""]],
+	"<div align=\"justify\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
+["<div align=justify><p>foo</div> <p>[bar]</p> <div align=justify><p>baz</div>",
+	[["stylewithcss","true"],["justifyfull",""]],
+	"<div align=\"justify\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyfull":[false,false,"left",false,true,"justify"]}],
 ["foo[]bar<p>extra",
 	[["stylewithcss","false"],["justifyleft",""]],
 	"foo[]bar<p>extra</p>",
@@ -20183,6 +20471,54 @@
 	[["stylewithcss","true"],["justifyleft",""]],
 	"<div style=\"text-align:left\"><div dir=\"rtl\">[foo]</div></div><p>extra</p>",
 	{"stylewithcss":[false,false,"",false,true,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<div style=text-align:left><p>foo</div> <p>[bar]",
+	[["stylewithcss","false"],["justifyleft",""]],
+	"<div style=\"text-align:left\"><p>foo</p></div> <p>[bar]</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<div style=text-align:left><p>foo</div> <p>[bar]",
+	[["stylewithcss","true"],["justifyleft",""]],
+	"<div style=\"text-align:left\"><p>foo</p></div> <p>[bar]</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<div align=left><p>foo</div> <p>[bar]",
+	[["stylewithcss","false"],["justifyleft",""]],
+	"<div align=\"left\"><p>foo</p></div> <p>[bar]</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<div align=left><p>foo</div> <p>[bar]",
+	[["stylewithcss","true"],["justifyleft",""]],
+	"<div align=\"left\"><p>foo</p></div> <p>[bar]</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<p>[foo]</p> <div style=text-align:left><p>bar</div>",
+	[["stylewithcss","false"],["justifyleft",""]],
+	"<p>[foo]</p> <div style=\"text-align:left\"><p>bar</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<p>[foo]</p> <div style=text-align:left><p>bar</div>",
+	[["stylewithcss","true"],["justifyleft",""]],
+	"<p>[foo]</p> <div style=\"text-align:left\"><p>bar</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<p>[foo]</p> <div align=left><p>bar</div>",
+	[["stylewithcss","false"],["justifyleft",""]],
+	"<p>[foo]</p> <div align=\"left\"><p>bar</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<p>[foo]</p> <div align=left><p>bar</div>",
+	[["stylewithcss","true"],["justifyleft",""]],
+	"<p>[foo]</p> <div align=\"left\"><p>bar</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<div style=text-align:left><p>foo</div> <p>[bar]</p> <div style=text-align:left><p>baz</div>",
+	[["stylewithcss","false"],["justifyleft",""]],
+	"<div style=\"text-align:left\"><p>foo</p></div> <p>[bar]</p> <div style=\"text-align:left\"><p>baz</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<div style=text-align:left><p>foo</div> <p>[bar]</p> <div style=text-align:left><p>baz</div>",
+	[["stylewithcss","true"],["justifyleft",""]],
+	"<div style=\"text-align:left\"><p>foo</p></div> <p>[bar]</p> <div style=\"text-align:left\"><p>baz</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<div align=left><p>foo</div> <p>[bar]</p> <div align=left><p>baz</div>",
+	[["stylewithcss","false"],["justifyleft",""]],
+	"<div align=\"left\"><p>foo</p></div> <p>[bar]</p> <div align=\"left\"><p>baz</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyleft":[false,true,"left",false,true,"left"]}],
+["<div align=left><p>foo</div> <p>[bar]</p> <div align=left><p>baz</div>",
+	[["stylewithcss","true"],["justifyleft",""]],
+	"<div align=\"left\"><p>foo</p></div> <p>[bar]</p> <div align=\"left\"><p>baz</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyleft":[false,true,"left",false,true,"left"]}],
 ["foo[]bar<p>extra",
 	[["stylewithcss","false"],["justifyright",""]],
 	"<div style=\"text-align:right\">foo[]bar</div><p>extra</p>",
@@ -20831,6 +21167,54 @@
 	[["stylewithcss","true"],["justifyright",""]],
 	"<div dir=\"rtl\">[foo]</div><p>extra</p>",
 	{"stylewithcss":[false,false,"",false,true,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<div style=text-align:right><p>foo</div> <p>[bar]",
+	[["stylewithcss","false"],["justifyright",""]],
+	"<div style=\"text-align:right\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<div style=text-align:right><p>foo</div> <p>[bar]",
+	[["stylewithcss","true"],["justifyright",""]],
+	"<div style=\"text-align:right\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<div align=right><p>foo</div> <p>[bar]",
+	[["stylewithcss","false"],["justifyright",""]],
+	"<div align=\"right\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<div align=right><p>foo</div> <p>[bar]",
+	[["stylewithcss","true"],["justifyright",""]],
+	"<div align=\"right\"><p>foo</p> <p>[bar]</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<p>[foo]</p> <div style=text-align:right><p>bar</div>",
+	[["stylewithcss","false"],["justifyright",""]],
+	"<div style=\"text-align:right\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<p>[foo]</p> <div style=text-align:right><p>bar</div>",
+	[["stylewithcss","true"],["justifyright",""]],
+	"<div style=\"text-align:right\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<p>[foo]</p> <div align=right><p>bar</div>",
+	[["stylewithcss","false"],["justifyright",""]],
+	"<div align=\"right\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<p>[foo]</p> <div align=right><p>bar</div>",
+	[["stylewithcss","true"],["justifyright",""]],
+	"<div align=\"right\"><p>[foo]</p> <p>bar</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<div style=text-align:right><p>foo</div> <p>[bar]</p> <div style=text-align:right><p>baz</div>",
+	[["stylewithcss","false"],["justifyright",""]],
+	"<div style=\"text-align:right\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<div style=text-align:right><p>foo</div> <p>[bar]</p> <div style=text-align:right><p>baz</div>",
+	[["stylewithcss","true"],["justifyright",""]],
+	"<div style=\"text-align:right\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<div align=right><p>foo</div> <p>[bar]</p> <div align=right><p>baz</div>",
+	[["stylewithcss","false"],["justifyright",""]],
+	"<div align=\"right\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,true,"",false,false,""],"justifyright":[false,false,"left",false,true,"right"]}],
+["<div align=right><p>foo</div> <p>[bar]</p> <div align=right><p>baz</div>",
+	[["stylewithcss","true"],["justifyright",""]],
+	"<div align=\"right\"><p>foo</p> <p>[bar]</p> <p>baz</p></div>",
+	{"stylewithcss":[false,false,"",false,true,""],"justifyright":[false,false,"left",false,true,"right"]}],
 ["<blockquote><p>foo[bar]</p><p>baz</p></blockquote><p>extra",
 	[["stylewithcss","false"],["outdent",""]],
 	"<p>foo[bar]</p><blockquote><p>baz</p></blockquote><p>extra</p>",
@@ -21551,6 +21935,150 @@
 	[["stylewithcss","true"],["outdent",""]],
 	"<blockquote><ol><li>foo</li><li>[bar]</li><li>baz</li></ol></blockquote>",
 	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote> <p>[foo]</p></blockquote>",
+	[["stylewithcss","false"],["outdent",""]],
+	" <p>[foo]</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote> <p>[foo]</p></blockquote>",
+	[["stylewithcss","true"],["outdent",""]],
+	" <p>[foo]</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote><p>[foo]</p> </blockquote>",
+	[["stylewithcss","false"],["outdent",""]],
+	"<p>[foo]</p> ",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote><p>[foo]</p> </blockquote>",
+	[["stylewithcss","true"],["outdent",""]],
+	"<p>[foo]</p> ",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote> <p>[foo]</p> </blockquote>",
+	[["stylewithcss","false"],["outdent",""]],
+	" <p>[foo]</p> ",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote> <p>[foo]</p> </blockquote>",
+	[["stylewithcss","true"],["outdent",""]],
+	" <p>[foo]</p> ",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ol> <li>[foo]</li></ol>",
+	[["stylewithcss","false"],["outdent",""]],
+	" <p>[foo]</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ol> <li>[foo]</li></ol>",
+	[["stylewithcss","true"],["outdent",""]],
+	" <p>[foo]</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ol><li>[foo]</li> </ol>",
+	[["stylewithcss","false"],["outdent",""]],
+	"<p>[foo]</p> ",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ol><li>[foo]</li> </ol>",
+	[["stylewithcss","true"],["outdent",""]],
+	"<p>[foo]</p> ",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ol> <li>[foo]</li> </ol>",
+	[["stylewithcss","false"],["outdent",""]],
+	" <p>[foo]</p> ",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ol> <li>[foo]</li> </ol>",
+	[["stylewithcss","true"],["outdent",""]],
+	" <p>[foo]</p> ",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ul> <li>[foo]</li></ul>",
+	[["stylewithcss","false"],["outdent",""]],
+	" <p>[foo]</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ul> <li>[foo]</li></ul>",
+	[["stylewithcss","true"],["outdent",""]],
+	" <p>[foo]</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ul><li>[foo]</li> </ul>",
+	[["stylewithcss","false"],["outdent",""]],
+	"<p>[foo]</p> ",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ul><li>[foo]</li> </ul>",
+	[["stylewithcss","true"],["outdent",""]],
+	"<p>[foo]</p> ",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ul> <li>[foo]</li> </ul>",
+	[["stylewithcss","false"],["outdent",""]],
+	" <p>[foo]</p> ",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ul> <li>[foo]</li> </ul>",
+	[["stylewithcss","true"],["outdent",""]],
+	" <p>[foo]</p> ",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote> <p>[foo]</p> <p>bar</p> <p>baz</p></blockquote>",
+	[["stylewithcss","false"],["outdent",""]],
+	" <p>[foo]</p><blockquote> <p>bar</p> <p>baz</p></blockquote>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote> <p>[foo]</p> <p>bar</p> <p>baz</p></blockquote>",
+	[["stylewithcss","true"],["outdent",""]],
+	" <p>[foo]</p><blockquote> <p>bar</p> <p>baz</p></blockquote>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote> <p>foo</p> <p>[bar]</p> <p>baz</p></blockquote>",
+	[["stylewithcss","false"],["outdent",""]],
+	"<blockquote> <p>foo</p> </blockquote><p>[bar]</p><blockquote> <p>baz</p></blockquote>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote> <p>foo</p> <p>[bar]</p> <p>baz</p></blockquote>",
+	[["stylewithcss","true"],["outdent",""]],
+	"<blockquote> <p>foo</p> </blockquote><p>[bar]</p><blockquote> <p>baz</p></blockquote>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote> <p>foo</p> <p>bar</p> <p>[baz]</p></blockquote>",
+	[["stylewithcss","false"],["outdent",""]],
+	"<blockquote> <p>foo</p> <p>bar</p> </blockquote><p>[baz]</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<blockquote> <p>foo</p> <p>bar</p> <p>[baz]</p></blockquote>",
+	[["stylewithcss","true"],["outdent",""]],
+	"<blockquote> <p>foo</p> <p>bar</p> </blockquote><p>[baz]</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ol> <li>[foo]</li> <li>bar</li> <li>baz</li></ol>",
+	[["stylewithcss","false"],["outdent",""]],
+	" <p>[foo]</p> <ol><li>bar</li> <li>baz</li></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ol> <li>[foo]</li> <li>bar</li> <li>baz</li></ol>",
+	[["stylewithcss","true"],["outdent",""]],
+	" <p>[foo]</p> <ol><li>bar</li> <li>baz</li></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ol> <li>foo</li> <li>[bar]</li> <li>baz</li></ol>",
+	[["stylewithcss","false"],["outdent",""]],
+	"<ol> <li>foo</li></ol> <p>[bar]</p> <ol><li>baz</li></ol>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ol> <li>foo</li> <li>[bar]</li> <li>baz</li></ol>",
+	[["stylewithcss","true"],["outdent",""]],
+	"<ol> <li>foo</li></ol> <p>[bar]</p> <ol><li>baz</li></ol>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ol> <li>foo</li> <li>bar</li> <li>[baz]</li></ol>",
+	[["stylewithcss","false"],["outdent",""]],
+	"<ol> <li>foo</li> <li>bar</li></ol> <p>[baz]</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ol> <li>foo</li> <li>bar</li> <li>[baz]</li></ol>",
+	[["stylewithcss","true"],["outdent",""]],
+	"<ol> <li>foo</li> <li>bar</li></ol> <p>[baz]</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ul> <li>[foo]</li> <li>bar</li> <li>baz</li></ul>",
+	[["stylewithcss","false"],["outdent",""]],
+	" <p>[foo]</p> <ul><li>bar</li> <li>baz</li></ul>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ul> <li>[foo]</li> <li>bar</li> <li>baz</li></ul>",
+	[["stylewithcss","true"],["outdent",""]],
+	" <p>[foo]</p> <ul><li>bar</li> <li>baz</li></ul>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ul> <li>foo</li> <li>[bar]</li> <li>baz</li></ul>",
+	[["stylewithcss","false"],["outdent",""]],
+	"<ul> <li>foo</li></ul> <p>[bar]</p> <ul><li>baz</li></ul>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ul> <li>foo</li> <li>[bar]</li> <li>baz</li></ul>",
+	[["stylewithcss","true"],["outdent",""]],
+	"<ul> <li>foo</li></ul> <p>[bar]</p> <ul><li>baz</li></ul>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
+["<ul> <li>foo</li> <li>bar</li> <li>[baz]</li></ul>",
+	[["stylewithcss","false"],["outdent",""]],
+	"<ul> <li>foo</li> <li>bar</li></ul> <p>[baz]</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"outdent":[false,false,"",false,false,""]}],
+["<ul> <li>foo</li> <li>bar</li> <li>[baz]</li></ul>",
+	[["stylewithcss","true"],["outdent",""]],
+	"<ul> <li>foo</li> <li>bar</li></ul> <p>[baz]</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"outdent":[false,false,"",false,false,""]}],
 ["<ol><li>[]a<table><tr><td><br></table></ol>",
 	[["stylewithcss","false"],["outdent",""]],
 	"<p>[]a</p><table><tbody><tr><td><br></td></tr></tbody></table>",
@@ -22457,11 +22985,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["strikethrough",""]],
-	"<p><s>[foo</s></p><p> <s><span>bar</span> </s></p><p><s>baz]</s></p>",
+	"<p><s>[foo</s></p><p> <s><span>bar</span></s> </p><p><s>baz]</s></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"strikethrough":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["strikethrough",""]],
-	"<p><span style=\"text-decoration:line-through\">[foo</span></p><p> <span style=\"text-decoration:line-through\"><span>bar</span> </span></p><p><span style=\"text-decoration:line-through\">baz]</span></p>",
+	"<p><span style=\"text-decoration:line-through\">[foo</span></p><p> <span style=\"text-decoration:line-through\"><span>bar</span></span> </p><p><span style=\"text-decoration:line-through\">baz]</span></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["strikethrough",""]],
@@ -23105,11 +23633,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["subscript",""]],
-	"<p><sub>[foo</sub></p><p> <sub><span>bar</span> </sub></p><p><sub>baz]</sub></p>",
+	"<p><sub>[foo</sub></p><p> <sub><span>bar</span></sub> </p><p><sub>baz]</sub></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["subscript",""]],
-	"<p><sub>[foo</sub></p><p> <sub><span>bar</span> </sub></p><p><sub>baz]</sub></p>",
+	"<p><sub>[foo</sub></p><p> <sub><span>bar</span></sub> </p><p><sub>baz]</sub></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["subscript",""]],
@@ -23489,11 +24017,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"superscript":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["superscript",""]],
-	"<p><sup>[foo</sup></p><p> <sup><span>bar</span> </sup></p><p><sup>baz]</sup></p>",
+	"<p><sup>[foo</sup></p><p> <sup><span>bar</span></sup> </p><p><sup>baz]</sup></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"superscript":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["superscript",""]],
-	"<p><sup>[foo</sup></p><p> <sup><span>bar</span> </sup></p><p><sup>baz]</sup></p>",
+	"<p><sup>[foo</sup></p><p> <sup><span>bar</span></sup> </p><p><sup>baz]</sup></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"superscript":[false,false,"",false,true,""]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["superscript",""]],
@@ -23881,11 +24409,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","false"],["underline",""]],
-	"<p><u>[foo</u></p><p> <u><span>bar</span> </u></p><p><u>baz]</u></p>",
+	"<p><u>[foo</u></p><p> <u><span>bar</span></u> </p><p><u>baz]</u></p>",
 	{"stylewithcss":[false,true,"",false,false,""],"underline":[false,false,"",false,true,""]}],
 ["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
 	[["stylewithcss","true"],["underline",""]],
-	"<p><span style=\"text-decoration:underline\">[foo</span></p><p> <span style=\"text-decoration:underline\"><span>bar</span> </span></p><p><span style=\"text-decoration:underline\">baz]</span></p>",
+	"<p><span style=\"text-decoration:underline\">[foo</span></p><p> <span style=\"text-decoration:underline\"><span>bar</span></span> </p><p><span style=\"text-decoration:underline\">baz]</span></p>",
 	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["underline",""]],
--- a/editing.html	Wed Sep 21 11:53:03 2011 -0600
+++ b/editing.html	Wed Sep 21 14:29:54 2011 -0600
@@ -1462,8 +1462,16 @@
 <var title="">new parent instructions</var> creating and returning a new <code title="">&lt;b&gt;</code> element.
 
 <ol>
-  <li>If <var title="">node list</var> is empty, or the first member of <var title="">node
-  list</var> is not <a href=#editable>editable</a>, return null and abort these steps.
+  <li>
+  <p class=comments>We need to treat <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>s as visible here even if they're
+  not, because wrapping them might be significant even if they're invisible: it
+  can turn an extraneous line break into a non-extraneous one.
+
+  <p>If every member of <var title="">node list</var> is <a href=#invisible>invisible</a>, and
+  none is a <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>, return null and abort these steps.
+
+  <li>If <var title="">node list</var>'s first member's <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a> is null, return null
+  and abort these steps.
 
   <li>
   <p class=comments>Trailing br's like this always need to go along with their
@@ -1474,6 +1482,22 @@
   that's not a <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>, and <var title="">node list</var>'s last member's <code class=external data-anolis-spec=domcore title=dom-Node-nextSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-nextsibling>nextSibling</a></code>
   is a <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>, append that <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code> to <var title="">node list</var>.
 
+  <li>
+  <p class=comments>See <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=13811">bug 13811</a>, <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=14231">bug 14231</a>.  If
+  there's a non-adjacent sibling that matches the sibling criteria and only
+  invisible nodes intervene, we want to skip over the invisible nodes.  For
+  instance, bolding <code title="">&lt;b&gt;foo&lt;/b&gt;&lt;!--bar--&gt;[baz]</code> should produce
+  <code title="">&lt;b&gt;foo&lt;!--bar--&gt;baz&lt;/b&gt;</code>.  Similarly, and more usefully, creating an
+  ordered list with <code title="">&lt;ol&gt;&lt;li&gt;foo&lt;/ol&gt; &lt;p&gt;[bar]&lt;/p&gt;</code> should produce
+  <code title="">&lt;ol&gt;&lt;li&gt;foo&lt;/li&gt; &lt;li&gt;[bar]&lt;/ol&gt;</code>, not
+  <code title="">&lt;ol&gt;&lt;li&gt;foo&lt;/ol&gt; &lt;ol&gt;&lt;li&gt;[bar]&lt;/ol&gt;</code>.
+
+  <p>While <var title="">node list</var>'s first member's <code class=external data-anolis-spec=domcore title=dom-Node-previousSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-previoussibling>previousSibling</a></code> is
+  <a href=#invisible>invisible</a>, prepend it to <var title="">node list</var>.
+
+  <li>While <var title="">node list</var>'s last member's <code class=external data-anolis-spec=domcore title=dom-Node-nextSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-nextsibling>nextSibling</a></code> is
+  <a href=#invisible>invisible</a>, append it to <var title="">node list</var>.
+
   <li>If the <code class=external data-anolis-spec=domcore title=dom-Node-previousSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-previoussibling>previousSibling</a></code> of the first member of <var title="">node list</var>
   is <a href=#editable>editable</a> and running <var title="">sibling criteria</var> on it
   returns true, let <var title="">new parent</var> be the <code class=external data-anolis-spec=domcore title=dom-Node-previousSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-previoussibling>previousSibling</a></code> of the
@@ -1572,9 +1596,9 @@
 
   <ol>
     <li>If <var title="">new parent</var> is not an <a href=#inline-node>inline node</a>, but the
-    last <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">new parent</var> and the first member of <var title="">node
-    list</var> are both <a href=#inline-node title="inline node">inline nodes</a>, and the
-    last <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">new parent</var> is not a <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>, call <code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("br")</a></code> on the
+    last <a href=#visible>visible</a> <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">new parent</var> and the first
+    <a href=#visible>visible</a> member of <var title="">node list</var> are both <a href=#inline-node title="inline node">inline nodes</a>, and the last <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">new
+    parent</var> is not a <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>, call <code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("br")</a></code> on the
     <code class=external data-anolis-spec=domcore title=dom-Node-ownerDocument><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-ownerdocument>ownerDocument</a></code> of <var title="">new parent</var> and append the result as the
     last <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">new parent</var>.
 
@@ -1587,9 +1611,9 @@
 
   <ol>
     <li>If <var title="">new parent</var> is not an <a href=#inline-node>inline node</a>, but the
-    first <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">new parent</var> and the last member of <var title="">node
-    list</var> are both <a href=#inline-node title="inline node">inline nodes</a>, and the
-    last member of <var title="">node list</var> is not a <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>, call <code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("br")</a></code> on the
+    first <a href=#visible>visible</a> <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">new parent</var> and the last
+    <a href=#visible>visible</a> member of <var title="">node list</var> are both <a href=#inline-node title="inline node">inline nodes</a>, and the last member of <var title="">node
+    list</var> is not a <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>, call <code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("br")</a></code> on the
     <code class=external data-anolis-spec=domcore title=dom-Node-ownerDocument><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-ownerdocument>ownerDocument</a></code> of <var title="">new parent</var> and insert the result as the
     first <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">new parent</var>.
 
@@ -7841,9 +7865,19 @@
   <p class=comments>Without this step, the last child of the previous sibling
   might be a list, which the li wouldn't get appended to.
 
-  <p>If the first member of <var title="">node list</var> is an <code class=external data-anolis-spec=html title="the li element"><a href=http://www.whatwg.org/html/#the-li-element>li</a></code> whose <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a>
-  is an <code class=external data-anolis-spec=html title="the ol element"><a href=http://www.whatwg.org/html/#the-ol-element>ol</a></code> or <code class=external data-anolis-spec=html title="the ul element"><a href=http://www.whatwg.org/html/#the-ul-element>ul</a></code>, and its <code class=external data-anolis-spec=domcore title=dom-Node-previousSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-previoussibling>previousSibling</a></code> is an <code class=external data-anolis-spec=html title="the li element"><a href=http://www.whatwg.org/html/#the-li-element>li</a></code> as well,
-  <a href=#normalize-sublists>normalize sublists</a> of its <code class=external data-anolis-spec=domcore title=dom-Node-previousSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-previoussibling>previousSibling</a></code>.
+  <p>If the first <a href=#visible>visible</a> member of <var title="">node list</var> is an
+  <code class=external data-anolis-spec=html title="the li element"><a href=http://www.whatwg.org/html/#the-li-element>li</a></code> whose <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a> is an <code class=external data-anolis-spec=html title="the ol element"><a href=http://www.whatwg.org/html/#the-ol-element>ol</a></code> or <code class=external data-anolis-spec=html title="the ul element"><a href=http://www.whatwg.org/html/#the-ul-element>ul</a></code>:
+
+  <ol>
+    <li>Let <var title="">sibling</var> be <var title="">node list</var>'s first
+    <a href=#visible>visible</a> member's <code class=external data-anolis-spec=domcore title=dom-Node-previousSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-previoussibling>previousSibling</a></code>.
+
+    <li>While <var title="">sibling</var> is <a href=#invisible>invisible</a>, set
+    <var title="">sibling</var> to its <code class=external data-anolis-spec=domcore title=dom-Node-previousSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-previoussibling>previousSibling</a></code>.
+
+    <li>If <var title="">sibling</var> is an <code class=external data-anolis-spec=html title="the li element"><a href=http://www.whatwg.org/html/#the-li-element>li</a></code>, <a href=#normalize-sublists>normalize sublists</a> of
+    <var title="">sibling</var>.
+  </ol>
 
   <li>While <var title="">node list</var> is not empty:
 
--- a/implementation.js	Wed Sep 21 11:53:03 2011 -0600
+++ b/implementation.js	Wed Sep 21 14:29:54 2011 -0600
@@ -1349,10 +1349,16 @@
 		newParentInstructions = function() { return null };
 	}
 
-	// "If node list is empty, or the first member of node list is not
-	// editable, return null and abort these steps."
-	if (!nodeList.length
-	|| !isEditable(nodeList[0])) {
+	// "If every member of node list is invisible, and none is a br, return
+	// null and abort these steps."
+	if (nodeList.every(isInvisible)
+	&& !nodeList.some(function(node) { return isHtmlElement(node, "br") })) {
+		return null;
+	}
+
+	// "If node list's first member's parent is null, return null and abort
+	// these steps."
+	if (!nodeList[0].parentNode) {
 		return null;
 	}
 
@@ -1364,6 +1370,18 @@
 		nodeList.push(nodeList[nodeList.length - 1].nextSibling);
 	}
 
+	// "While node list's first member's previousSibling is invisible, prepend
+	// it to node list."
+	while (isInvisible(nodeList[0].previousSibling)) {
+		nodeList.unshift(nodeList[0].previousSibling);
+	}
+
+	// "While node list's last member's nextSibling is invisible, append it to
+	// node list."
+	while (isInvisible(nodeList[nodeList.length - 1].nextSibling)) {
+		nodeList.push(nodeList[nodeList.length - 1].nextSibling);
+	}
+
 	// "If the previousSibling of the first member of node list is editable and
 	// running sibling criteria on it returns true, let new parent be the
 	// previousSibling of the first member of node list."
@@ -1416,14 +1434,14 @@
 
 	// "If new parent is before the first member of node list in tree order:"
 	if (isBefore(newParent, nodeList[0])) {
-		// "If new parent is not an inline node, but the last child of new
-		// parent and the first member of node list are both inline nodes, and
-		// the last child of new parent is not a br, call createElement("br")
-		// on the ownerDocument of new parent and append the result as the last
-		// child of new parent."
+		// "If new parent is not an inline node, but the last visible child of
+		// new parent and the first visible member of node list are both inline
+		// nodes, and the last child of new parent is not a br, call
+		// createElement("br") on the ownerDocument of new parent and append
+		// the result as the last child of new parent."
 		if (!isInlineNode(newParent)
-		&& isInlineNode(newParent.lastChild)
-		&& isInlineNode(nodeList[0])
+		&& isInlineNode([].filter.call(newParent.childNodes, isVisible).slice(-1)[0])
+		&& isInlineNode(nodeList.filter(isVisible)[0])
 		&& !isHtmlElement(newParent.lastChild, "BR")) {
 			newParent.appendChild(newParent.ownerDocument.createElement("br"));
 		}
@@ -1436,14 +1454,14 @@
 
 	// "Otherwise:"
 	} else {
-		// "If new parent is not an inline node, but the first child of new
-		// parent and the last member of node list are both inline nodes, and
-		// the last member of node list is not a br, call createElement("br")
-		// on the ownerDocument of new parent and insert the result as the
-		// first child of new parent."
+		// "If new parent is not an inline node, but the first visible child of
+		// new parent and the last visible member of node list are both inline
+		// nodes, and the last member of node list is not a br, call
+		// createElement("br") on the ownerDocument of new parent and insert
+		// the result as the first child of new parent."
 		if (!isInlineNode(newParent)
-		&& isInlineNode(newParent.firstChild)
-		&& isInlineNode(nodeList[nodeList.length - 1])
+		&& isInlineNode([].filter.call(newParent.childNodes, isVisible)[0])
+		&& isInlineNode(nodeList.filter(isVisible).slice(-1)[0])
 		&& !isHtmlElement(nodeList[nodeList.length - 1], "BR")) {
 			newParent.insertBefore(newParent.ownerDocument.createElement("br"), newParent.firstChild);
 		}
@@ -6750,14 +6768,24 @@
 				|| isAllowedChild(node, "ol"));
 		});
 
-		// "If the first member of node list is an li whose parent is an ol or
-		// ul, and its previousSibling is an li as well, normalize sublists of
-		// its previousSibling."
-		if (nodeList.length
-		&& isHtmlElement(nodeList[0], "LI")
-		&& isHtmlElement(nodeList[0].parentNode, ["OL", "UL"])
-		&& isHtmlElement(nodeList[0].previousSibling, "LI")) {
-			normalizeSublists(nodeList[0].previousSibling);
+		// "If the first visible member of node list is an li whose parent is
+		// an ol or ul:"
+		if (isHtmlElement(nodeList.filter(isVisible)[0], "li")
+		&& isHtmlElement(nodeList.filter(isVisible)[0].parentNode, ["ol", "ul"])) {
+			// "Let sibling be node list's first visible member's
+			// previousSibling."
+			var sibling = nodeList.filter(isVisible)[0].previousSibling;
+
+			// "While sibling is invisible, set sibling to its
+			// previousSibling."
+			while (isInvisible(sibling)) {
+				sibling = sibling.previousSibling;
+			}
+
+			// "If sibling is an li, normalize sublists of sibling."
+			if (isHtmlElement(sibling, "li")) {
+				normalizeSublists(sibling);
+			}
 		}
 
 		// "While node list is not empty:"
--- a/source.html	Wed Sep 21 11:53:03 2011 -0600
+++ b/source.html	Wed Sep 21 14:29:54 2011 -0600
@@ -1432,8 +1432,16 @@
 title>&lt;b></code> element.
 
 <ol>
-  <li>If <var>node list</var> is empty, or the first member of <var>node
-  list</var> is not <span>editable</span>, return null and abort these steps.
+  <li>
+  <p class=comments>We need to treat [[br]]s as visible here even if they're
+  not, because wrapping them might be significant even if they're invisible: it
+  can turn an extraneous line break into a non-extraneous one.
+
+  <p>If every member of <var>node list</var> is <span>invisible</span>, and
+  none is a [[br]], return null and abort these steps.
+
+  <li>If <var>node list</var>'s first member's [[parent]] is null, return null
+  and abort these steps.
 
   <li>
   <p class=comments>Trailing br's like this always need to go along with their
@@ -1444,6 +1452,24 @@
   that's not a [[br]], and <var>node list</var>'s last member's [[nextsibling]]
   is a [[br]], append that [[br]] to <var>node list</var>.
 
+  <li>
+  <p class=comments>See <a
+  href=http://www.w3.org/Bugs/Public/show_bug.cgi?id=13811>bug 13811</a>, <a
+  href=http://www.w3.org/Bugs/Public/show_bug.cgi?id=14231>bug 14231</a>.  If
+  there's a non-adjacent sibling that matches the sibling criteria and only
+  invisible nodes intervene, we want to skip over the invisible nodes.  For
+  instance, bolding {{code|<b>foo</b><!--bar-->[baz]}} should produce
+  {{code|<b>foo<!--bar-->baz</b>}}.  Similarly, and more usefully, creating an
+  ordered list with {{code|<ol><li>foo</ol> <p>[bar]</p>}} should produce
+  {{code|<ol><li>foo</li> <li>[bar]</ol>}}, not
+  {{code|<ol><li>foo</ol> <ol><li>[bar]</ol>}}.
+
+  <p>While <var>node list</var>'s first member's [[previoussibling]] is
+  <span>invisible</span>, prepend it to <var>node list</var>.
+
+  <li>While <var>node list</var>'s last member's [[nextsibling]] is
+  <span>invisible</span>, append it to <var>node list</var>.
+
   <li>If the [[previoussibling]] of the first member of <var>node list</var>
   is <span>editable</span> and running <var>sibling criteria</var> on it
   returns true, let <var>new parent</var> be the [[previoussibling]] of the
@@ -1546,11 +1572,10 @@
 
   <ol>
     <li>If <var>new parent</var> is not an <span>inline node</span>, but the
-    last [[child]] of <var>new parent</var> and the first member of <var>node
-    list</var> are both <span title="inline node">inline nodes</span>, and the
-    last [[child]] of <var>new parent</var> is not a [[br]], call <code
-    data-anolis-spec=domcore
-    title=dom-Document-createElement>createElement("br")</code> on the
+    last <span>visible</span> [[child]] of <var>new parent</var> and the first
+    <span>visible</span> member of <var>node list</var> are both <span
+    title="inline node">inline nodes</span>, and the last [[child]] of <var>new
+    parent</var> is not a [[br]], call [[createelement|"br"]] on the
     [[ownerdocument]] of <var>new parent</var> and append the result as the
     last [[child]] of <var>new parent</var>.
 
@@ -1563,11 +1588,10 @@
 
   <ol>
     <li>If <var>new parent</var> is not an <span>inline node</span>, but the
-    first [[child]] of <var>new parent</var> and the last member of <var>node
-    list</var> are both <span title="inline node">inline nodes</span>, and the
-    last member of <var>node list</var> is not a [[br]], call <code
-    data-anolis-spec=domcore
-    title=dom-Document-createElement>createElement("br")</code> on the
+    first <span>visible</span> [[child]] of <var>new parent</var> and the last
+    <span>visible</span> member of <var>node list</var> are both <span
+    title="inline node">inline nodes</span>, and the last member of <var>node
+    list</var> is not a [[br]], call [[createelement|"br"]] on the
     [[ownerdocument]] of <var>new parent</var> and insert the result as the
     first [[child]] of <var>new parent</var>.
 
@@ -7907,9 +7931,19 @@
   <p class=comments>Without this step, the last child of the previous sibling
   might be a list, which the li wouldn't get appended to.
 
-  <p>If the first member of <var>node list</var> is an [[li]] whose [[parent]]
-  is an [[ol]] or [[ul]], and its [[previoussibling]] is an [[li]] as well,
-  <span>normalize sublists</span> of its [[previoussibling]].
+  <p>If the first <span>visible</span> member of <var>node list</var> is an
+  [[li]] whose [[parent]] is an [[ol]] or [[ul]]:
+
+  <ol>
+    <li>Let <var>sibling</var> be <var>node list</var>'s first
+    <span>visible</span> member's [[previoussibling]].
+
+    <li>While <var>sibling</var> is <span>invisible</span>, set
+    <var>sibling</var> to its [[previoussibling]].
+
+    <li>If <var>sibling</var> is an [[li]], <span>normalize sublists</span> of
+    <var>sibling</var>.
+  </ol>
 
   <li>While <var>node list</var> is not empty:
 
--- a/tests.js	Wed Sep 21 11:53:03 2011 -0600
+++ b/tests.js	Wed Sep 21 14:29:54 2011 -0600
@@ -1715,6 +1715,23 @@
 		'<p>foo<!--bar-->{}<p>extra',
 		'<p>{}<!--foo-->bar<p>extra',
 
+		// Whitespace nodes
+		'<blockquote><p>foo</blockquote> <p>[bar]',
+		'<p>[foo]</p> <blockquote><p>bar</blockquote>',
+		'<blockquote><p>foo</blockquote> <p>[bar]</p> <blockquote><p>baz</blockquote>',
+		'<ol><li>foo</li><ol><li>bar</li> </ol><li>[baz]</ol>',
+		'<ol><li>foo</li><ol><li>bar</li></ol> <li>[baz]</ol>',
+		'<ol><li>foo</li><ol><li>bar</li> </ol> <li>[baz]</ol>',
+		'<ol><li>foo<ol><li>bar</li> </ol></li><li>[baz]</ol>',
+		'<ol><li>foo<ol><li>bar</li></ol></li> <li>[baz]</ol>',
+		'<ol><li>foo<ol><li>bar</li> </ol></li> <li>[baz]</ol>',
+		'<ol><li>foo<li>[bar]</li> <ol><li>baz</ol></ol>',
+		'<ol><li>foo<li>[bar]</li><ol> <li>baz</ol></ol>',
+		'<ol><li>foo<li>[bar]</li> <ol> <li>baz</ol></ol>',
+		'<ol><li>foo<li>[bar] <ol><li>baz</ol></ol>',
+		'<ol><li>foo<li>[bar]<ol> <li>baz</ol></ol>',
+		'<ol><li>foo<li>[bar] <ol> <li>baz</ol></ol>',
+
 		// https://bugs.webkit.org/show_bug.cgi?id=32003
 		'<ul><li>a<br>{<br>}</li><li>b</li></ul>',
 	],
@@ -2102,6 +2119,11 @@
 		'<ul id=abc><li>foo<li>bar<li>[baz]</ul>',
 		'<ul style=color:blue><li>foo<li>bar<li>[baz]</ul>',
 		'<ul style=text-indent:1em><li>foo<li>bar<li>[baz]</ul>',
+
+		// Whitespace nodes
+		'<ol><li>foo</ol> <p>[bar]',
+		'<p>[foo]</p> <ol><li>bar</ol>',
+		'<ol><li>foo</ol> <p>[bar]</p> <ol><li>baz</ol>',
 	],
 	//@}
 	insertparagraph: [
@@ -2539,6 +2561,11 @@
 		'<ul style=color:blue><li>foo<li>bar<li>[baz]</ul>',
 		'<ul style=text-indent:1em><li>foo<li>bar<li>[baz]</ul>',
 
+		// Whitespace nodes
+		'<ul><li>foo</ul> <p>[bar]',
+		'<p>[foo]</p> <ul><li>bar</ul>',
+		'<ul><li>foo</ul> <p>[bar]</p> <ul><li>baz</ul>',
+
 		// https://bugs.webkit.org/show_bug.cgi?id=24167
 		'{<div style="font-size: 1.3em">1</div><div style="font-size: 1.1em">2</div>}',
 	],
@@ -2745,6 +2772,17 @@
 		'<div style=text-align:end>[foo]</div><p>extra',
 		'<div dir=rtl style=text-align:start>[foo]</div><p>extra',
 		'<div dir=rtl style=text-align:end>[foo]</div><p>extra',
+
+		// Whitespace nodes
+		'<div style=text-align:center><p>foo</div> <p>[bar]',
+		'<div align=center><p>foo</div> <p>[bar]',
+		'<center><p>foo</center> <p>[bar]',
+		'<p>[foo]</p> <div style=text-align:center><p>bar</div>',
+		'<p>[foo]</p> <div align=center><p>bar</div>',
+		'<p>[foo]</p> <center><p>bar</center>',
+		'<div style=text-align:center><p>foo</div> <p>[bar]</p> <div style=text-align:center><p>baz</div>',
+		'<div align=center><p>foo</div> <p>[bar]</p> <div align=center><p>baz</div>',
+		'<center><p>foo</center> <p>[bar]</p> <center><p>baz</center>',
 	],
 	//@}
 	justifyfull: [
@@ -2843,6 +2881,14 @@
 		'<div style=text-align:end>[foo]</div><p>extra',
 		'<div dir=rtl style=text-align:start>[foo]</div><p>extra',
 		'<div dir=rtl style=text-align:end>[foo]</div><p>extra',
+
+		// Whitespace nodes
+		'<div style=text-align:justify><p>foo</div> <p>[bar]',
+		'<div align=justify><p>foo</div> <p>[bar]',
+		'<p>[foo]</p> <div style=text-align:justify><p>bar</div>',
+		'<p>[foo]</p> <div align=justify><p>bar</div>',
+		'<div style=text-align:justify><p>foo</div> <p>[bar]</p> <div style=text-align:justify><p>baz</div>',
+		'<div align=justify><p>foo</div> <p>[bar]</p> <div align=justify><p>baz</div>',
 	],
 	//@}
 	justifyleft: [
@@ -2941,6 +2987,14 @@
 		'<div style=text-align:end>[foo]</div><p>extra',
 		'<div dir=rtl style=text-align:start>[foo]</div><p>extra',
 		'<div dir=rtl style=text-align:end>[foo]</div><p>extra',
+
+		// Whitespace nodes
+		'<div style=text-align:left><p>foo</div> <p>[bar]',
+		'<div align=left><p>foo</div> <p>[bar]',
+		'<p>[foo]</p> <div style=text-align:left><p>bar</div>',
+		'<p>[foo]</p> <div align=left><p>bar</div>',
+		'<div style=text-align:left><p>foo</div> <p>[bar]</p> <div style=text-align:left><p>baz</div>',
+		'<div align=left><p>foo</div> <p>[bar]</p> <div align=left><p>baz</div>',
 	],
 	//@}
 	justifyright: [
@@ -3039,6 +3093,14 @@
 		'<div style=text-align:end>[foo]</div><p>extra',
 		'<div dir=rtl style=text-align:start>[foo]</div><p>extra',
 		'<div dir=rtl style=text-align:end>[foo]</div><p>extra',
+
+		// Whitespace nodes
+		'<div style=text-align:right><p>foo</div> <p>[bar]',
+		'<div align=right><p>foo</div> <p>[bar]',
+		'<p>[foo]</p> <div style=text-align:right><p>bar</div>',
+		'<p>[foo]</p> <div align=right><p>bar</div>',
+		'<div style=text-align:right><p>foo</div> <p>[bar]</p> <div style=text-align:right><p>baz</div>',
+		'<div align=right><p>foo</div> <p>[bar]</p> <div align=right><p>baz</div>',
 	],
 	//@}
 	outdent: [
@@ -3158,6 +3220,26 @@
 		'<ol><li><xmp>[foo]</xmp></li></ol>',
 		'<blockquote><ol><li>foo<div><ol><li>[bar]</ol></div><li>baz</ol></blockquote>',
 
+		// Whitespace nodes
+		'<blockquote> <p>[foo]</p></blockquote>',
+		'<blockquote><p>[foo]</p> </blockquote>',
+		'<blockquote> <p>[foo]</p> </blockquote>',
+		'<ol> <li>[foo]</li></ol>',
+		'<ol><li>[foo]</li> </ol>',
+		'<ol> <li>[foo]</li> </ol>',
+		'<ul> <li>[foo]</li></ul>',
+		'<ul><li>[foo]</li> </ul>',
+		'<ul> <li>[foo]</li> </ul>',
+		'<blockquote> <p>[foo]</p> <p>bar</p> <p>baz</p></blockquote>',
+		'<blockquote> <p>foo</p> <p>[bar]</p> <p>baz</p></blockquote>',
+		'<blockquote> <p>foo</p> <p>bar</p> <p>[baz]</p></blockquote>',
+		'<ol> <li>[foo]</li> <li>bar</li> <li>baz</li></ol>',
+		'<ol> <li>foo</li> <li>[bar]</li> <li>baz</li></ol>',
+		'<ol> <li>foo</li> <li>bar</li> <li>[baz]</li></ol>',
+		'<ul> <li>[foo]</li> <li>bar</li> <li>baz</li></ul>',
+		'<ul> <li>foo</li> <li>[bar]</li> <li>baz</li></ul>',
+		'<ul> <li>foo</li> <li>bar</li> <li>[baz]</li></ul>',
+
 		// https://bugs.webkit.org/show_bug.cgi?id=24249
 		'<ol><li>[]a<table><tr><td><br></table></ol>',
 		// https://bugs.webkit.org/show_bug.cgi?id=43447