Don't wrap invisible nodes when forcing style
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Mon, 19 Sep 2011 15:35:44 -0600
changeset 608 b2d328d179ac
parent 607 5c35a3a49bd1
child 609 4321a7e11603
Don't wrap invisible nodes when forcing style

In the course of doing this, I had to also make state and indeterm
ignore invisible nodes. Otherwise, you'd bold something like
<p>[foo</p> <p>bar]</p>
and get
<p><b>[foo</b></p> <p><b>bar]</b></p>
which would have indeterm true and state false, because of the editable
text node " " in between the paragraphs. I introduced a new concept of
"formattable node" to make this cleaner and allow easier future changes.

I also rationalized the boilerplate tests at the beginning of each
inline formatting command, making them all the same.

One lingering issue I don't like so much: the test
<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>
becomes something like
<p><b>[foo</b></p><p> <b><span>bar</span> </b></p><p><b>baz]</b></p>
with the first invisible node outside the <b> but the second inside.
This is because we go through the nodes sequentially, and do merge
invisible nodes into adjacent wrappers, but don't create a wrapper for
them. So we get something like
<p> <span>bar</span> </p>
-> <p> <b><span>bar</span></b> </p>
-> <p> <b><span>bar</span> </b></p>
where the first " " is unaffected because there's no adjacent <b> yet,
but the second gets stuck into the <b> added for the span. This isn't a
big deal, but it's a bit weird, and worth revisiting. I haven't marked
the relevant tests as bad, but perhaps I should.

Fixes: http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996
conformancetest/data.js
editing.html
implementation.js
source.html
tests.js
--- a/conformancetest/data.js	Wed Sep 21 11:18:04 2011 -0600
+++ b/conformancetest/data.js	Mon Sep 19 15:35:44 2011 -0600
@@ -7,6 +7,38 @@
 	[["stylewithcss","true"],["backcolor","#00FFFF"]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
+["<p>[foo</p> <p>bar]</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)\">bar]</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>bar]</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)\">bar]</span></p>",
+	{"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>",
+	{"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>",
+	{"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"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["backcolor","#00FFFF"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["backcolor","#00FFFF"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["backcolor","#00FFFF"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["backcolor","#00FFFF"]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -31,13 +63,13 @@
 	[["stylewithcss","true"],["backcolor","#00FFFF"]],
 	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar]</span>baz",
 	{"stylewithcss":[false,false,"",false,true,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
-["foo]bar[baz",
-	[["stylewithcss","false"],["backcolor","#00FFFF"]],
-	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar]</span>baz",
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","false"],["backcolor","#00FFFF"]],
+	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar</span><b><span style=\"background-color:rgb(0, 255, 255)\">baz]</span>qoz</b>quz",
 	{"stylewithcss":[false,true,"",false,false,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
-["foo]bar[baz",
-	[["stylewithcss","true"],["backcolor","#00FFFF"]],
-	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar]</span>baz",
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","true"],["backcolor","#00FFFF"]],
+	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar</span><b><span style=\"background-color:rgb(0, 255, 255)\">baz]</span>qoz</b>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
 ["foo[bar<i>baz]qoz</i>quz",
 	[["stylewithcss","false"],["backcolor","#00FFFF"]],
@@ -47,6 +79,14 @@
 	[["stylewithcss","true"],["backcolor","#00FFFF"]],
 	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar</span><i><span style=\"background-color:rgb(0, 255, 255)\">baz]</span>qoz</i>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["backcolor","#00FFFF"]],
+	"{<p></p><p> </p><p><span style=\"background-color:rgb(0, 255, 255)\">foo</span></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgba(0, 0, 0, 0)"]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["backcolor","#00FFFF"]],
+	"{<p></p><p> </p><p><span style=\"background-color:rgb(0, 255, 255)\">foo</span></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"backcolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgba(0, 0, 0, 0)"]}],
 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>",
 	[["stylewithcss","false"],["backcolor","#00FFFF"]],
 	"<table><tbody><tr><td>foo</td><td>b<span style=\"background-color:rgb(0, 255, 255)\">[a]</span>r</td><td>baz</td></tr></tbody></table>",
@@ -287,6 +327,22 @@
 	[["stylewithcss","true"],["bold",""]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"bold":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","false"],["bold",""]],
+	"<p><b>[foo</b></p> <p><b>bar]</b></p>",
+	{"stylewithcss":[false,true,"",false,false,""],"bold":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","true"],["bold",""]],
+	"<p><span style=\"font-weight:bold\">[foo</span></p> <p><span style=\"font-weight:bold\">bar]</span></p>",
+	{"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>",
+	{"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>",
+	{"stylewithcss":[false,false,"",false,true,""],"bold":[false,false,"",false,true,""]}],
 ["<b>foo[]bar</b>",
 	[["stylewithcss","false"],["bold",""]],
 	"<b>foo[]bar</b>",
@@ -295,6 +351,14 @@
 	[["stylewithcss","true"],["bold",""]],
 	"<b>foo[]bar</b>",
 	{"stylewithcss":[false,false,"",false,true,""],"bold":[false,true,"",false,false,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["bold",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"bold":[false,false,"",false,true,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["bold",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"bold":[false,false,"",false,true,""]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["bold",""]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -319,6 +383,14 @@
 	[["stylewithcss","true"],["bold",""]],
 	"foo<span style=\"font-weight:bold\">[bar]</span>baz",
 	{"stylewithcss":[false,false,"",false,true,""],"bold":[false,false,"",false,true,""]}],
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","false"],["bold",""]],
+	"foo<b>[barbaz]qoz</b>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"bold":[true,false,"",false,true,""]}],
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","true"],["bold",""]],
+	"foo<b>[barbaz]qoz</b>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"bold":[true,false,"",false,true,""]}],
 ["foo[bar<i>baz]qoz</i>quz",
 	[["stylewithcss","false"],["bold",""]],
 	"foo<b>[bar</b><i><b>baz]</b>qoz</i>quz",
@@ -327,6 +399,14 @@
 	[["stylewithcss","true"],["bold",""]],
 	"foo<span style=\"font-weight:bold\">[bar</span><i><span style=\"font-weight:bold\">baz]</span>qoz</i>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"bold":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["bold",""]],
+	"{<p></p><p> </p><p><b>foo</b></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"bold":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["bold",""]],
+	"{<p></p><p> </p><p><span style=\"font-weight:bold\">foo</span></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"bold":[false,false,"",false,true,""]}],
 ["foo<span contenteditable=false>[bar]</span>baz",
 	[["stylewithcss","false"],["bold",""]],
 	"foo<span contenteditable=\"false\">[bar]</span>baz",
@@ -1215,6 +1295,38 @@
 	[["stylewithcss","true"],["createlink","http://www.google.com/"]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"createlink":[false,false,"",false,false,""]}],
+["<p>[foo</p> <p>bar]</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/\">bar]</a></p>",
+	{"stylewithcss":[false,true,"",false,false,""],"createlink":[false,false,"",false,false,""]}],
+["<p>[foo</p> <p>bar]</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/\">bar]</a></p>",
+	{"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>",
+	{"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>",
+	{"stylewithcss":[false,false,"",false,true,""],"createlink":[false,false,"",false,false,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","false"],["createlink","http://www.google.com/"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"createlink":[false,false,"",false,false,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["createlink","http://www.google.com/"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"createlink":[false,false,"",false,false,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["createlink","http://www.google.com/"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"createlink":[false,false,"",false,false,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["createlink","http://www.google.com/"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"createlink":[false,false,"",false,false,""]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["createlink","http://www.google.com/"]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -1239,13 +1351,29 @@
 	[["stylewithcss","true"],["createlink","http://www.google.com/"]],
 	"foo<a href=\"http://www.google.com/\">[bar]</a>baz",
 	{"stylewithcss":[false,false,"",false,true,""],"createlink":[false,false,"",false,false,""]}],
-["foo]bar[baz",
-	[["stylewithcss","false"],["createlink","http://www.google.com/"]],
-	"foo<a href=\"http://www.google.com/\">[bar]</a>baz",
-	{"stylewithcss":[false,true,"",false,false,""],"createlink":[false,false,"",false,false,""]}],
-["foo]bar[baz",
-	[["stylewithcss","true"],["createlink","http://www.google.com/"]],
-	"foo<a href=\"http://www.google.com/\">[bar]</a>baz",
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","false"],["createlink","http://www.google.com/"]],
+	"foo<a href=\"http://www.google.com/\">[bar</a><b><a href=\"http://www.google.com/\">baz]</a>qoz</b>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"createlink":[false,false,"",false,false,""]}],
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","true"],["createlink","http://www.google.com/"]],
+	"foo<a href=\"http://www.google.com/\">[bar</a><b><a href=\"http://www.google.com/\">baz]</a>qoz</b>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"createlink":[false,false,"",false,false,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","false"],["createlink","http://www.google.com/"]],
+	"foo<a href=\"http://www.google.com/\">[bar</a><i><a href=\"http://www.google.com/\">baz]</a>qoz</i>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"createlink":[false,false,"",false,false,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","true"],["createlink","http://www.google.com/"]],
+	"foo<a href=\"http://www.google.com/\">[bar</a><i><a href=\"http://www.google.com/\">baz]</a>qoz</i>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"createlink":[false,false,"",false,false,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["createlink","http://www.google.com/"]],
+	"{<p></p><p> </p><p><a href=\"http://www.google.com/\">foo</a></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"createlink":[false,false,"",false,false,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["createlink","http://www.google.com/"]],
+	"{<p></p><p> </p><p><a href=\"http://www.google.com/\">foo</a></p>}",
 	{"stylewithcss":[false,false,"",false,true,""],"createlink":[false,false,"",false,false,""]}],
 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>",
 	[["stylewithcss","false"],["createlink","http://www.google.com/"]],
@@ -3735,6 +3863,38 @@
 	[["stylewithcss","true"],["fontname","sans-serif"]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","false"],["fontname","sans-serif"]],
+	"<p><font face=\"sans-serif\">[foo</font></p> <p><font face=\"sans-serif\">bar]</font></p>",
+	{"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","true"],["fontname","sans-serif"]],
+	"<p><span style=\"font-family:sans-serif\">[foo</span></p> <p><span style=\"font-family:sans-serif\">bar]</span></p>",
+	{"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>",
+	{"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>",
+	{"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","false"],["fontname","sans-serif"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["fontname","sans-serif"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["fontname","sans-serif"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["fontname","sans-serif"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["fontname","sans-serif"]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -3759,14 +3919,30 @@
 	[["stylewithcss","true"],["fontname","sans-serif"]],
 	"foo<span style=\"font-family:sans-serif\">[bar]</span>baz",
 	{"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
-["foo]bar[baz",
-	[["stylewithcss","false"],["fontname","sans-serif"]],
-	"foo<font face=\"sans-serif\">[bar]</font>baz",
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","false"],["fontname","sans-serif"]],
+	"foo<font face=\"sans-serif\">[bar</font><b><font face=\"sans-serif\">baz]</font>qoz</b>quz",
 	{"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
-["foo]bar[baz",
-	[["stylewithcss","true"],["fontname","sans-serif"]],
-	"foo<span style=\"font-family:sans-serif\">[bar]</span>baz",
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","true"],["fontname","sans-serif"]],
+	"foo<span style=\"font-family:sans-serif\">[bar</span><b><span style=\"font-family:sans-serif\">baz]</span>qoz</b>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","false"],["fontname","sans-serif"]],
+	"foo<font face=\"sans-serif\">[bar</font><i><font face=\"sans-serif\">baz]</font>qoz</i>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","true"],["fontname","sans-serif"]],
+	"foo<span style=\"font-family:sans-serif\">[bar</span><i><span style=\"font-family:sans-serif\">baz]</span>qoz</i>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"serif",false,false,"sans-serif"]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["fontname","sans-serif"]],
+	"{<p></p><p> </p><p><font face=\"sans-serif\">foo</font></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"serif",false,false,"serif"]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["fontname","sans-serif"]],
+	"{<p></p><p> </p><p><span style=\"font-family:sans-serif\">foo</span></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"serif",false,false,"serif"]}],
 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>",
 	[["stylewithcss","false"],["fontname","sans-serif"]],
 	"<table><tbody><tr><td>foo</td><td>b<font face=\"sans-serif\">[a]</font>r</td><td>baz</td></tr></tbody></table>",
@@ -4271,6 +4447,38 @@
 	[["stylewithcss","true"],["fontsize","4"]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","false"],["fontsize","4"]],
+	"<p><font size=\"4\">[foo</font></p> <p><font size=\"4\">bar]</font></p>",
+	{"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","true"],["fontsize","4"]],
+	"<p><span style=\"font-size:large\">[foo</span></p> <p><span style=\"font-size:large\">bar]</span></p>",
+	{"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>",
+	{"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>",
+	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","false"],["fontsize","4"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["fontsize","4"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["fontsize","4"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["fontsize","4"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["fontsize","4"]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -4288,6 +4496,38 @@
 	"<span>foo[</span><span>]bar</span>",
 	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
 ["foo[bar]baz",
+	[["stylewithcss","false"],["fontsize","4"]],
+	"foo<font size=\"4\">[bar]</font>baz",
+	{"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["foo[bar]baz",
+	[["stylewithcss","true"],["fontsize","4"]],
+	"foo<span style=\"font-size:large\">[bar]</span>baz",
+	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","false"],["fontsize","4"]],
+	"foo<font size=\"4\">[bar</font><b><font size=\"4\">baz]</font>qoz</b>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","true"],["fontsize","4"]],
+	"foo<span style=\"font-size:large\">[bar</span><b><span style=\"font-size:large\">baz]</span>qoz</b>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","false"],["fontsize","4"]],
+	"foo<font size=\"4\">[bar</font><i><font size=\"4\">baz]</font>qoz</i>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","true"],["fontsize","4"]],
+	"foo<span style=\"font-size:large\">[bar</span><i><span style=\"font-size:large\">baz]</span>qoz</i>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["fontsize","4"]],
+	"{<p></p><p> </p><p><font size=\"4\">foo</font></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["fontsize","4"]],
+	"{<p></p><p> </p><p><span style=\"font-size:large\">foo</span></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
+["foo[bar]baz",
 	[["stylewithcss","false"],["fontsize","1"]],
 	"foo<font size=\"1\">[bar]</font>baz",
 	{"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"1"]}],
@@ -4471,14 +4711,6 @@
 	[["stylewithcss","true"],["fontsize",""]],
 	"foo[bar]baz",
 	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"3"]}],
-["foo[bar<i>baz]qoz</i>quz",
-	[["stylewithcss","false"],["fontsize","4"]],
-	"foo<font size=\"4\">[bar</font><i><font size=\"4\">baz]</font>qoz</i>quz",
-	{"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}],
-["foo[bar<i>baz]qoz</i>quz",
-	[["stylewithcss","true"],["fontsize","4"]],
-	"foo<span style=\"font-size:large\">[bar</span><i><span style=\"font-size:large\">baz]</span>qoz</i>quz",
-	{"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}],
 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>",
 	[["stylewithcss","false"],["fontsize","4"]],
 	"<table><tbody><tr><td>foo</td><td>b<font size=\"4\">[a]</font>r</td><td>baz</td></tr></tbody></table>",
@@ -4895,6 +5127,38 @@
 	[["stylewithcss","true"],["forecolor","#0000FF"]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","false"],["forecolor","#0000FF"]],
+	"<p><font color=\"#0000ff\">[foo</font></p> <p><font color=\"#0000ff\">bar]</font></p>",
+	{"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","true"],["forecolor","#0000FF"]],
+	"<p><span style=\"color:rgb(0, 0, 255)\">[foo</span></p> <p><span style=\"color:rgb(0, 0, 255)\">bar]</span></p>",
+	{"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>",
+	{"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>",
+	{"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"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["forecolor","#0000FF"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["forecolor","#0000FF"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["forecolor","#0000FF"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["forecolor","#0000FF"]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -4919,13 +5183,13 @@
 	[["stylewithcss","true"],["forecolor","#0000FF"]],
 	"foo<span style=\"color:rgb(0, 0, 255)\">[bar]</span>baz",
 	{"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
-["foo]bar[baz",
-	[["stylewithcss","false"],["forecolor","#0000FF"]],
-	"foo<font color=\"#0000ff\">[bar]</font>baz",
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","false"],["forecolor","#0000FF"]],
+	"foo<font color=\"#0000ff\">[bar</font><b><font color=\"#0000ff\">baz]</font>qoz</b>quz",
 	{"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
-["foo]bar[baz",
-	[["stylewithcss","true"],["forecolor","#0000FF"]],
-	"foo<span style=\"color:rgb(0, 0, 255)\">[bar]</span>baz",
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","true"],["forecolor","#0000FF"]],
+	"foo<span style=\"color:rgb(0, 0, 255)\">[bar</span><b><span style=\"color:rgb(0, 0, 255)\">baz]</span>qoz</b>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
 ["foo[bar<i>baz]qoz</i>quz",
 	[["stylewithcss","false"],["forecolor","#0000FF"]],
@@ -4935,6 +5199,14 @@
 	[["stylewithcss","true"],["forecolor","#0000FF"]],
 	"foo<span style=\"color:rgb(0, 0, 255)\">[bar</span><i><span style=\"color:rgb(0, 0, 255)\">baz]</span>qoz</i>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["forecolor","#0000FF"]],
+	"{<p></p><p> </p><p><font color=\"#0000ff\">foo</font></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 0)"]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["forecolor","#0000FF"]],
+	"{<p></p><p> </p><p><span style=\"color:rgb(0, 0, 255)\">foo</span></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 0)"]}],
 ["foo[bar]baz",
 	[["stylewithcss","false"],["forecolor","blue"]],
 	"foo<font color=\"#0000ff\">[bar]</font>baz",
@@ -9455,6 +9727,38 @@
 	[["stylewithcss","true"],["hilitecolor","#00FFFF"]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
+["<p>[foo</p> <p>bar]</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)\">bar]</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>bar]</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)\">bar]</span></p>",
+	{"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>",
+	{"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>",
+	{"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"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["hilitecolor","#00FFFF"]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["hilitecolor","#00FFFF"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["hilitecolor","#00FFFF"]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["hilitecolor","#00FFFF"]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -9479,21 +9783,13 @@
 	[["stylewithcss","true"],["hilitecolor","#00FFFF"]],
 	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar]</span>baz",
 	{"stylewithcss":[false,false,"",false,true,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
-["foo]bar[baz",
-	[["stylewithcss","false"],["hilitecolor","#00FFFF"]],
-	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar]</span>baz",
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","false"],["hilitecolor","#00FFFF"]],
+	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar</span><b><span style=\"background-color:rgb(0, 255, 255)\">baz]</span>qoz</b>quz",
 	{"stylewithcss":[false,true,"",false,false,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
-["foo]bar[baz",
-	[["stylewithcss","true"],["hilitecolor","#00FFFF"]],
-	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar]</span>baz",
-	{"stylewithcss":[false,false,"",false,true,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
-["{<p><p> <p>foo</p>}",
-	[["stylewithcss","false"],["hilitecolor","#00FFFF"]],
-	"{<p></p><p><span style=\"background-color:rgb(0, 255, 255)\"> </span></p><p><span style=\"background-color:rgb(0, 255, 255)\">foo</span></p>}",
-	{"stylewithcss":[false,true,"",false,false,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
-["{<p><p> <p>foo</p>}",
-	[["stylewithcss","true"],["hilitecolor","#00FFFF"]],
-	"{<p></p><p><span style=\"background-color:rgb(0, 255, 255)\"> </span></p><p><span style=\"background-color:rgb(0, 255, 255)\">foo</span></p>}",
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","true"],["hilitecolor","#00FFFF"]],
+	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar</span><b><span style=\"background-color:rgb(0, 255, 255)\">baz]</span>qoz</b>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
 ["foo[bar<i>baz]qoz</i>quz",
 	[["stylewithcss","false"],["hilitecolor","#00FFFF"]],
@@ -9503,6 +9799,14 @@
 	[["stylewithcss","true"],["hilitecolor","#00FFFF"]],
 	"foo<span style=\"background-color:rgb(0, 255, 255)\">[bar</span><i><span style=\"background-color:rgb(0, 255, 255)\">baz]</span>qoz</i>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgb(0, 255, 255)"]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["hilitecolor","#00FFFF"]],
+	"{<p></p><p> </p><p><span style=\"background-color:rgb(0, 255, 255)\">foo</span></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgba(0, 0, 0, 0)"]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["hilitecolor","#00FFFF"]],
+	"{<p></p><p> </p><p><span style=\"background-color:rgb(0, 255, 255)\">foo</span></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"hilitecolor":[false,false,"rgba(0, 0, 0, 0)",false,false,"rgba(0, 0, 0, 0)"]}],
 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>",
 	[["stylewithcss","false"],["hilitecolor","#00FFFF"]],
 	"<table><tbody><tr><td>foo</td><td>b<span style=\"background-color:rgb(0, 255, 255)\">[a]</span>r</td><td>baz</td></tr></tbody></table>",
@@ -17167,6 +17471,38 @@
 	[["stylewithcss","true"],["italic",""]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"italic":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","false"],["italic",""]],
+	"<p><i>[foo</i></p> <p><i>bar]</i></p>",
+	{"stylewithcss":[false,true,"",false,false,""],"italic":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","true"],["italic",""]],
+	"<p><span style=\"font-style:italic\">[foo</span></p> <p><span style=\"font-style:italic\">bar]</span></p>",
+	{"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>",
+	{"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>",
+	{"stylewithcss":[false,false,"",false,true,""],"italic":[false,false,"",false,true,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","false"],["italic",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"italic":[false,false,"",false,true,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["italic",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"italic":[false,false,"",false,true,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["italic",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"italic":[false,true,"",false,false,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["italic",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"italic":[false,true,"",false,false,""]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["italic",""]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -17191,14 +17527,6 @@
 	[["stylewithcss","true"],["italic",""]],
 	"foo<span style=\"font-style:italic\">[bar]</span>baz",
 	{"stylewithcss":[false,false,"",false,true,""],"italic":[false,false,"",false,true,""]}],
-["foo]bar[baz",
-	[["stylewithcss","false"],["italic",""]],
-	"foo<i>[bar]</i>baz",
-	{"stylewithcss":[false,true,"",false,false,""],"italic":[false,false,"",false,true,""]}],
-["foo]bar[baz",
-	[["stylewithcss","true"],["italic",""]],
-	"foo<span style=\"font-style:italic\">[bar]</span>baz",
-	{"stylewithcss":[false,false,"",false,true,""],"italic":[false,false,"",false,true,""]}],
 ["foo[bar<b>baz]qoz</b>quz",
 	[["stylewithcss","false"],["italic",""]],
 	"foo<i>[bar</i><b><i>baz]</i>qoz</b>quz",
@@ -17207,6 +17535,22 @@
 	[["stylewithcss","true"],["italic",""]],
 	"foo<span style=\"font-style:italic\">[bar</span><b><span style=\"font-style:italic\">baz]</span>qoz</b>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"italic":[false,false,"",false,true,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","false"],["italic",""]],
+	"foo<i>[barbaz]qoz</i>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"italic":[true,false,"",false,true,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","true"],["italic",""]],
+	"foo<i>[barbaz]qoz</i>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"italic":[true,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["italic",""]],
+	"{<p></p><p> </p><p><i>foo</i></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"italic":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["italic",""]],
+	"{<p></p><p> </p><p><span style=\"font-style:italic\">foo</span></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"italic":[false,false,"",false,true,""]}],
 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>",
 	[["stylewithcss","false"],["italic",""]],
 	"<table><tbody><tr><td>foo</td><td>b<i>[a]</i>r</td><td>baz</td></tr></tbody></table>",
@@ -22031,6 +22375,38 @@
 	[["stylewithcss","true"],["strikethrough",""]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","false"],["strikethrough",""]],
+	"<p><s>[foo</s></p> <p><s>bar]</s></p>",
+	{"stylewithcss":[false,true,"",false,false,""],"strikethrough":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","true"],["strikethrough",""]],
+	"<p><span style=\"text-decoration:line-through\">[foo</span></p> <p><span style=\"text-decoration:line-through\">bar]</span></p>",
+	{"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>",
+	{"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>",
+	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","false"],["strikethrough",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"strikethrough":[false,false,"",false,true,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["strikethrough",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["strikethrough",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"strikethrough":[false,false,"",false,true,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["strikethrough",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["strikethrough",""]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -22055,14 +22431,6 @@
 	[["stylewithcss","true"],["strikethrough",""]],
 	"foo<span style=\"text-decoration:line-through\">[bar]</span>baz",
 	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
-["foo]bar[baz",
-	[["stylewithcss","false"],["strikethrough",""]],
-	"foo<s>[bar]</s>baz",
-	{"stylewithcss":[false,true,"",false,false,""],"strikethrough":[false,false,"",false,true,""]}],
-["foo]bar[baz",
-	[["stylewithcss","true"],["strikethrough",""]],
-	"foo<span style=\"text-decoration:line-through\">[bar]</span>baz",
-	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
 ["foo[bar<b>baz]qoz</b>quz",
 	[["stylewithcss","false"],["strikethrough",""]],
 	"foo<s>[bar</s><b><s>baz]</s>qoz</b>quz",
@@ -22071,6 +22439,22 @@
 	[["stylewithcss","true"],["strikethrough",""]],
 	"foo<span style=\"text-decoration:line-through\">[bar</span><b><span style=\"text-decoration:line-through\">baz]</span>qoz</b>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","false"],["strikethrough",""]],
+	"foo<s>[bar</s><i><s>baz]</s>qoz</i>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"strikethrough":[false,false,"",false,true,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","true"],["strikethrough",""]],
+	"foo<span style=\"text-decoration:line-through\">[bar</span><i><span style=\"text-decoration:line-through\">baz]</span>qoz</i>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["strikethrough",""]],
+	"{<p></p><p> </p><p><s>foo</s></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"strikethrough":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["strikethrough",""]],
+	"{<p></p><p> </p><p><span style=\"text-decoration:line-through\">foo</span></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"strikethrough":[false,false,"",false,true,""]}],
 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>",
 	[["stylewithcss","false"],["strikethrough",""]],
 	"<table><tbody><tr><td>foo</td><td>b<s>[a]</s>r</td><td>baz</td></tr></tbody></table>",
@@ -22631,6 +23015,38 @@
 	[["stylewithcss","true"],["subscript",""]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","false"],["subscript",""]],
+	"<p><sub>[foo</sub></p> <p><sub>bar]</sub></p>",
+	{"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","true"],["subscript",""]],
+	"<p><sub>[foo</sub></p> <p><sub>bar]</sub></p>",
+	{"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>",
+	{"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>",
+	{"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","false"],["subscript",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["subscript",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["subscript",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["subscript",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["subscript",""]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -22663,6 +23079,22 @@
 	[["stylewithcss","true"],["subscript",""]],
 	"foo<sub>[bar</sub><b><sub>baz]</sub>qoz</b>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","false"],["subscript",""]],
+	"foo<sub>[bar</sub><i><sub>baz]</sub>qoz</i>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","true"],["subscript",""]],
+	"foo<sub>[bar</sub><i><sub>baz]</sub>qoz</i>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["subscript",""]],
+	"{<p></p><p> </p><p><sub>foo</sub></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"subscript":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["subscript",""]],
+	"{<p></p><p> </p><p><sub>foo</sub></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"subscript":[false,false,"",false,true,""]}],
 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>",
 	[["stylewithcss","false"],["subscript",""]],
 	"<table><tbody><tr><td>foo</td><td>b<sub>[a]</sub>r</td><td>baz</td></tr></tbody></table>",
@@ -22959,6 +23391,38 @@
 	[["stylewithcss","true"],["superscript",""]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"superscript":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","false"],["superscript",""]],
+	"<p><sup>[foo</sup></p> <p><sup>bar]</sup></p>",
+	{"stylewithcss":[false,true,"",false,false,""],"superscript":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","true"],["superscript",""]],
+	"<p><sup>[foo</sup></p> <p><sup>bar]</sup></p>",
+	{"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>",
+	{"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>",
+	{"stylewithcss":[false,false,"",false,true,""],"superscript":[false,false,"",false,true,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","false"],["superscript",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"superscript":[false,false,"",false,true,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["superscript",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"superscript":[false,false,"",false,true,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["superscript",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"superscript":[false,false,"",false,true,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["superscript",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"superscript":[false,false,"",false,true,""]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["superscript",""]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -22991,6 +23455,22 @@
 	[["stylewithcss","true"],["superscript",""]],
 	"foo<sup>[bar</sup><b><sup>baz]</sup>qoz</b>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"superscript":[false,false,"",false,true,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","false"],["superscript",""]],
+	"foo<sup>[bar</sup><i><sup>baz]</sup>qoz</i>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"superscript":[false,false,"",false,true,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","true"],["superscript",""]],
+	"foo<sup>[bar</sup><i><sup>baz]</sup>qoz</i>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"superscript":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["superscript",""]],
+	"{<p></p><p> </p><p><sup>foo</sup></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"superscript":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["superscript",""]],
+	"{<p></p><p> </p><p><sup>foo</sup></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"superscript":[false,false,"",false,true,""]}],
 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>",
 	[["stylewithcss","false"],["superscript",""]],
 	"<table><tbody><tr><td>foo</td><td>b<sup>[a]</sup>r</td><td>baz</td></tr></tbody></table>",
@@ -23281,11 +23761,11 @@
 	{"stylewithcss":[false,false,"",false,true,""],"superscript":[true,false,"",false,true,""]}],
 ["foo<sup>[bar]<br></sup>",
 	[["stylewithcss","false"],["superscript",""]],
-	"foo[bar]<sup><br></sup>",
+	"foo[bar]<br>",
 	{"stylewithcss":[false,true,"",false,false,""],"superscript":[false,true,"",false,false,""]}],
 ["foo<sup>[bar]<br></sup>",
 	[["stylewithcss","true"],["superscript",""]],
-	"foo[bar]<sup><br></sup>",
+	"foo[bar]<br>",
 	{"stylewithcss":[false,false,"",false,true,""],"superscript":[false,true,"",false,false,""]}],
 ["foo[]bar",
 	[["stylewithcss","false"],["underline",""]],
@@ -23295,6 +23775,38 @@
 	[["stylewithcss","true"],["underline",""]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","false"],["underline",""]],
+	"<p><u>[foo</u></p> <p><u>bar]</u></p>",
+	{"stylewithcss":[false,true,"",false,false,""],"underline":[false,false,"",false,true,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","true"],["underline",""]],
+	"<p><span style=\"text-decoration:underline\">[foo</span></p> <p><span style=\"text-decoration:underline\">bar]</span></p>",
+	{"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>",
+	{"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>",
+	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","false"],["underline",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"underline":[false,false,"",false,true,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["underline",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["underline",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"underline":[false,false,"",false,true,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["underline",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["underline",""]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -23319,14 +23831,6 @@
 	[["stylewithcss","true"],["underline",""]],
 	"foo<span style=\"text-decoration:underline\">[bar]</span>baz",
 	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
-["foo]bar[baz",
-	[["stylewithcss","false"],["underline",""]],
-	"foo<u>[bar]</u>baz",
-	{"stylewithcss":[false,true,"",false,false,""],"underline":[false,false,"",false,true,""]}],
-["foo]bar[baz",
-	[["stylewithcss","true"],["underline",""]],
-	"foo<span style=\"text-decoration:underline\">[bar]</span>baz",
-	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
 ["foo[bar<b>baz]qoz</b>quz",
 	[["stylewithcss","false"],["underline",""]],
 	"foo<u>[bar</u><b><u>baz]</u>qoz</b>quz",
@@ -23335,6 +23839,22 @@
 	[["stylewithcss","true"],["underline",""]],
 	"foo<span style=\"text-decoration:underline\">[bar</span><b><span style=\"text-decoration:underline\">baz]</span>qoz</b>quz",
 	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","false"],["underline",""]],
+	"foo<u>[bar</u><i><u>baz]</u>qoz</i>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"underline":[false,false,"",false,true,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","true"],["underline",""]],
+	"foo<span style=\"text-decoration:underline\">[bar</span><i><span style=\"text-decoration:underline\">baz]</span>qoz</i>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["underline",""]],
+	"{<p></p><p> </p><p><u>foo</u></p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"underline":[false,false,"",false,true,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["underline",""]],
+	"{<p></p><p> </p><p><span style=\"text-decoration:underline\">foo</span></p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"underline":[false,false,"",false,true,""]}],
 ["<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>",
 	[["stylewithcss","false"],["underline",""]],
 	"<table><tbody><tr><td>foo</td><td>b<u>[a]</u>r</td><td>baz</td></tr></tbody></table>",
@@ -23895,6 +24415,38 @@
 	[["stylewithcss","true"],["unlink",""]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"unlink":[false,false,"",false,false,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","false"],["unlink",""]],
+	"<p>[foo</p> <p>bar]</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"unlink":[false,false,"",false,false,""]}],
+["<p>[foo</p> <p>bar]</p>",
+	[["stylewithcss","true"],["unlink",""]],
+	"<p>[foo</p> <p>bar]</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"unlink":[false,false,"",false,false,""]}],
+["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
+	[["stylewithcss","false"],["unlink",""]],
+	"<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"unlink":[false,false,"",false,false,""]}],
+["<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
+	[["stylewithcss","true"],["unlink",""]],
+	"<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"unlink":[false,false,"",false,false,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","false"],["unlink",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"unlink":[false,false,"",false,false,""]}],
+["<b>foo[]bar</b>",
+	[["stylewithcss","true"],["unlink",""]],
+	"<b>foo[]bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"unlink":[false,false,"",false,false,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","false"],["unlink",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,true,"",false,false,""],"unlink":[false,false,"",false,false,""]}],
+["<i>foo[]bar</i>",
+	[["stylewithcss","true"],["unlink",""]],
+	"<i>foo[]bar</i>",
+	{"stylewithcss":[false,false,"",false,true,""],"unlink":[false,false,"",false,false,""]}],
 ["<span>foo</span>{}<span>bar</span>",
 	[["stylewithcss","false"],["unlink",""]],
 	"<span>foo</span>{}<span>bar</span>",
@@ -23911,6 +24463,38 @@
 	[["stylewithcss","true"],["unlink",""]],
 	"<span>foo[</span><span>]bar</span>",
 	{"stylewithcss":[false,false,"",false,true,""],"unlink":[false,false,"",false,false,""]}],
+["foo[bar]baz",
+	[["stylewithcss","false"],["unlink",""]],
+	"foo[bar]baz",
+	{"stylewithcss":[false,true,"",false,false,""],"unlink":[false,false,"",false,false,""]}],
+["foo[bar]baz",
+	[["stylewithcss","true"],["unlink",""]],
+	"foo[bar]baz",
+	{"stylewithcss":[false,false,"",false,true,""],"unlink":[false,false,"",false,false,""]}],
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","false"],["unlink",""]],
+	"foo[bar<b>baz]qoz</b>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"unlink":[false,false,"",false,false,""]}],
+["foo[bar<b>baz]qoz</b>quz",
+	[["stylewithcss","true"],["unlink",""]],
+	"foo[bar<b>baz]qoz</b>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"unlink":[false,false,"",false,false,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","false"],["unlink",""]],
+	"foo[bar<i>baz]qoz</i>quz",
+	{"stylewithcss":[false,true,"",false,false,""],"unlink":[false,false,"",false,false,""]}],
+["foo[bar<i>baz]qoz</i>quz",
+	[["stylewithcss","true"],["unlink",""]],
+	"foo[bar<i>baz]qoz</i>quz",
+	{"stylewithcss":[false,false,"",false,true,""],"unlink":[false,false,"",false,false,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","false"],["unlink",""]],
+	"{<p></p><p> </p><p>foo</p>}",
+	{"stylewithcss":[false,true,"",false,false,""],"unlink":[false,false,"",false,false,""]}],
+["{<p><p> <p>foo</p>}",
+	[["stylewithcss","true"],["unlink",""]],
+	"{<p></p><p> </p><p>foo</p>}",
+	{"stylewithcss":[false,false,"",false,true,""],"unlink":[false,false,"",false,false,""]}],
 ["<a href=http://www.google.com/>foo[bar]baz</a>",
 	[["stylewithcss","false"],["unlink",""]],
 	"foo[bar]baz",
--- a/editing.html	Wed Sep 21 11:18:04 2011 -0600
+++ b/editing.html	Mon Sep 19 15:35:44 2011 -0600
@@ -1902,6 +1902,9 @@
 command</a> will not remove it: it will nest <code title="">&lt;span
 style="font-style: normal"&gt;</code> inside.
 
+<p>A <dfn id=formattable-node>formattable node</dfn> is an <a href=#editable>editable</a>
+<a href=#visible>visible</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node.
+
 <p>Two quantities are <dfn id=equivalent-values>equivalent values</dfn> for a <a href=#command>command</a>
 if either both are null, or both are strings and they're equal and the
 <a href=#command>command</a> does not define any <a href=#equivalent-values>equivalent values</a>, or
@@ -1926,11 +1929,11 @@
 
 <p>If a <a href=#command>command</a> has <dfn id=inline-command-activated-values>inline command activated values</dfn>
 defined but nothing else defines when it is <a href=#indeterminate>indeterminate</a>, it is
-<a href=#indeterminate>indeterminate</a> if among <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> nodes
-<a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a>, there is
-at least one whose <a href=#effective-command-value>effective command value</a> is one of the given
-values and at least one whose <a href=#effective-command-value>effective command value</a> is not one
-of the given values.
+<a href=#indeterminate>indeterminate</a> if among <a href=#formattable-node title="formattable node">formattable
+nodes</a> <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active
+range</a>, there is at least one whose <a href=#effective-command-value>effective command value</a>
+is one of the given values and at least one whose <a href=#effective-command-value>effective command
+value</a> is not one of the given values.
 
 <p class=comments>For bold and similar commands, IE 9 RC seems to consider the
 state true or false depending on the first element.  All other browsers follow
@@ -1943,13 +1946,13 @@
 in all cases with a few exceptions.
 
 <p>If a <a href=#command>command</a> has <a href=#inline-command-activated-values>inline command activated values</a>
-defined, its <a href=#state>state</a> is true if either no <a href=#editable>editable</a>
-<code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node is <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active
+defined, its <a href=#state>state</a> is true if either no <a href=#formattable-node>formattable
+node</a> is <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active
 range</a>, and the <a href=#active-range>active range</a>'s <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-start title=concept-range-start>start</a> <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-boundary-point-node title=concept-boundary-point-node>node</a>'s
 <a href=#effective-command-value>effective command value</a> is one of the given values; or if there is
-at least one <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node <a href=#effectively-contained>effectively
-contained</a> in the <a href=#active-range>active range</a>, and all of them have an
-<a href=#effective-command-value>effective command value</a> equal to one of the given values.
+at least one <a href=#formattable-node>formattable node</a> <a href=#effectively-contained>effectively contained</a>
+in the <a href=#active-range>active range</a>, and all of them have an <a href=#effective-command-value>effective
+command value</a> equal to one of the given values.
 
 <div class=comments>
 <p>Testing with hiliteColor: Opera 11.11 seems to always return the effective
@@ -1967,13 +1970,13 @@
 </div>
 
 <p>If a command is a <dfn id=standard-inline-value-command>standard inline value command</dfn>, it is
-<a href=#indeterminate>indeterminate</a> if among <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> nodes that
-are <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a>, there
-are two that have distinct <a href=#effective-command-value title="effective command value">effective
-command values</a>.  Its <a href=#value>value</a> is the <a href=#effective-command-value>effective command
-value</a> of the first <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node that is
-<a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a>, or if
-there is no such node, the <a href=#effective-command-value>effective command value</a> of the
+<a href=#indeterminate>indeterminate</a> if among <a href=#formattable-node title="formattable node">formattable
+nodes</a> that are <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active
+range</a>, there are two that have distinct <a href=#effective-command-value title="effective command
+value">effective command values</a>.  Its <a href=#value>value</a> is the
+<a href=#effective-command-value>effective command value</a> of the first <a href=#formattable-node>formattable node</a>
+that is <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a>, or
+if there is no such node, the <a href=#effective-command-value>effective command value</a> of the
 <a href=#active-range>active range</a>'s <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-start title=concept-range-start>start</a> <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-boundary-point-node title=concept-boundary-point-node>node</a>.
 
 <p class=note>The effective command value of the active range's start node
@@ -2553,6 +2556,11 @@
     otherwise, and with <var title="">new parent instructions</var> returning null.
   </ol>
 
+  <li>
+  <p class=comments><a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996">Bug 13996</a>.
+
+  <p>If <var title="">node</var> is <a href=#invisible>invisible</a>, abort this algorithm.
+
   <li>If the <a href=#effective-command-value>effective command value</a> of <var title="">command</var> is
   <a href=#loosely-equivalent-values title="loosely equivalent values">loosely equivalent</a> to <var title="">new value</var> on <var title="">node</var>, abort this
   algorithm.
@@ -2898,7 +2906,7 @@
   general behavior: change the state/value, and then make sure that takes
   effect if the user types something before changing the cursor position.
 
-  <p>If there is no <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node <a href=#effectively-contained>effectively
+  <p>If there is no <a href=#formattable-node>formattable node</a> <a href=#effectively-contained>effectively
   contained</a> in the <a href=#active-range>active range</a>:
 
   <ol>
@@ -3371,10 +3379,10 @@
 but for the selection to still be indeterminate.  Setting the fontSize to the
 value will make it determinate without changing anything's value.
 
-<p><a href=#indeterminate>Indeterminate</a>: True if among <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code>
-nodes that are <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active
-range</a>, there are two that have distinct <a href=#effective-command-value title="effective command
-value">effective command values</a>.  Otherwise false.
+<p><a href=#indeterminate>Indeterminate</a>: True if among <a href=#formattable-node title="formattable
+node">formattable nodes</a> that are <a href=#effectively-contained>effectively contained</a> in
+the <a href=#active-range>active range</a>, there are two that have distinct <a href=#effective-command-value title="effective command value">effective command values</a>.  Otherwise
+false.
 
 <div class=comments>
 <dl>
@@ -3413,7 +3421,7 @@
   decided on this choice of node.
 
   <p>Let <var title="">pixel size</var> be the <a href=#effective-command-value>effective command value</a> of
-  the first <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node that is <a href=#effectively-contained>effectively
+  the first <a href=#formattable-node>formattable node</a> that is <a href=#effectively-contained>effectively
   contained</a> in the <a href=#active-range>active range</a>, or if there is no such
   node, the <a href=#effective-command-value>effective command value</a> of the <a href=#active-range>active
   range</a>'s <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-start title=concept-range-start>start</a> <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-boundary-point-node title=concept-boundary-point-node>node</a>, in either case interpreted as a number of
@@ -3810,13 +3818,13 @@
   "subscript".
 </ol>
 
-<p><a href=#indeterminate>Indeterminate</a>: True if either among <a href=#editable>editable</a>
-<code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> nodes that are <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active
-range</a>, there is at least one with <a href=#effective-command-value>effective command value</a>
-"subscript" and at least one with some other <a href=#effective-command-value>effective command
-value</a>; or if there is some <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node
-<a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a> with
-<a href=#effective-command-value>effective command value</a> "mixed".  Otherwise false.
+<p><a href=#indeterminate>Indeterminate</a>: True if either among <a href=#formattable-node title="formattable
+node">formattable nodes</a> that are <a href=#effectively-contained>effectively contained</a> in
+the <a href=#active-range>active range</a>, there is at least one with <a href=#effective-command-value>effective
+command value</a> "subscript" and at least one with some other
+<a href=#effective-command-value>effective command value</a>; or if there is some <a href=#formattable-node>formattable
+node</a> <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a>
+with <a href=#effective-command-value>effective command value</a> "mixed".  Otherwise false.
 
 <p class=comments> For &lt;sup&gt;&lt;sub&gt;foo&lt;/sub&gt;&lt;/sup&gt;, Firefox 6.0a2 and
 Opera 11.11 say the state is true for both superscript and subscript, and
@@ -3846,13 +3854,13 @@
   "superscript".
 </ol>
 
-<p><a href=#indeterminate>Indeterminate</a>: True if either among <a href=#editable>editable</a>
-<code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> nodes that are <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active
-range</a>, there is at least one with <a href=#effective-command-value>effective command value</a>
-"superscript" and at least one with some other <a href=#effective-command-value>effective command
-value</a>; or if there is some <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node
-<a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a> with
-<a href=#effective-command-value>effective command value</a> "mixed".  Otherwise false.
+<p><a href=#indeterminate>Indeterminate</a>: True if either among <a href=#formattable-node title="formattable
+node">formattable nodes</a> that are <a href=#effectively-contained>effectively contained</a> in
+the <a href=#active-range>active range</a>, there is at least one with <a href=#effective-command-value>effective
+command value</a> "superscript" and at least one with some other
+<a href=#effective-command-value>effective command value</a>; or if there is some <a href=#formattable-node>formattable
+node</a> <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a>
+with <a href=#effective-command-value>effective command value</a> "mixed".  Otherwise false.
 
 <p><a href=#inline-command-activated-values>Inline command activated values</a>: "superscript"
 
@@ -4460,7 +4468,7 @@
   <li>Let <var title="">overrides</var> be a list of (string, string or boolean) ordered
   pairs, initially empty.
 
-  <li>Let <var title="">node</var> be the first <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node
+  <li>Let <var title="">node</var> be the first <a href=#formattable-node>formattable node</a>
   <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a>, or null
   if there is none.
 
@@ -4471,9 +4479,9 @@
 
   <li>
   <p class=comments>Thus we will set state overrides based on the first
-  editable text node, to match values.  This means that if you have
-  &lt;p&gt;foo&lt;b&gt;[bar&lt;/b&gt;baz]&lt;/p&gt; and hit backspace and hit A, you'll get
-  &lt;p&gt;foo&lt;b&gt;a[]&lt;/b&gt;&lt;/p&gt;, although bold was previously indeterminate.
+  formattable node, to match values.  This means that if you have
+  <code title="">&lt;p&gt;foo&lt;b&gt;[bar&lt;/b&gt;baz]&lt;/p&gt;</code> and hit backspace and hit A, you'll get
+  <code title="">&lt;p&gt;foo&lt;b&gt;a[]&lt;/b&gt;&lt;/p&gt;</code>, although bold was previously indeterminate.
   This is needed to match the behavior of hitting A straight away, since
   innerText doesn't strip wrappers when it invokes "delete the contents".
 
@@ -4508,7 +4516,7 @@
 <a href=#record-current-states-and-values>record current states and values</a> algorithm:
 
 <ol>
-  <li>Let <var title="">node</var> be the first <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node
+  <li>Let <var title="">node</var> be the first <a href=#formattable-node>formattable node</a>
   <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a>, or null
   if there is none.
 
@@ -4563,7 +4571,7 @@
     selection was <code title="">foo[bar]baz</code>, the text node could have been split so
     that the first part is now outside the active range.
 
-    <p>Set <var title="">node</var> to the first <a href=#editable>editable</a> <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node
+    <p>Set <var title="">node</var> to the first <a href=#formattable-node>formattable node</a>
     <a href=#effectively-contained>effectively contained</a> in the <a href=#active-range>active range</a>, if
     there is one.
   </ol>
--- a/implementation.js	Wed Sep 21 11:18:04 2011 -0600
+++ b/implementation.js	Mon Sep 19 15:35:44 2011 -0600
@@ -1934,6 +1934,13 @@
 	return false;
 }
 
+// "A formattable node is an editable visible Text node."
+function isFormattableNode(node) {
+	return isEditable(node)
+		&& isVisible(node)
+		&& node.nodeType == Node.TEXT_NODE;
+}
+
 // "Two quantities are equivalent values for a command if either both are null,
 // or both are strings and they're equal and the command does not define any
 // equivalent values, or both are strings and the command defines equivalent
@@ -2660,6 +2667,11 @@
 		);
 	}
 
+	// "If node is invisible, abort this algorithm."
+	if (isInvisible(node)) {
+		return;
+	}
+
 	// "If the effective command value of command is loosely equivalent to new
 	// value on node, abort this algorithm."
 	if (areLooselyEquivalentValues(command, getEffectiveCommandValue(node, command), newValue)) {
@@ -2891,11 +2903,10 @@
 //@{
 
 function setSelectionValue(command, newValue) {
-	// "If there is no editable text node effectively contained in the active
+	// "If there is no formattable node effectively contained in the active
 	// range:"
 	if (!getAllEffectivelyContainedNodes(getActiveRange())
-	.filter(function(node) { return node.nodeType == Node.TEXT_NODE})
-	.some(isEditable)) {
+	.some(isFormattableNode)) {
 		// "If command has inline command activated values, set the state
 		// override to true if new value is among them and false if it's not."
 		if ("inlineCommandActivatedValues" in commands[command]) {
@@ -3203,25 +3214,22 @@
 		// "Set the selection's value to value."
 		setSelectionValue("fontsize", value);
 	}, indeterm: function() {
-		// "True if among editable Text nodes that are effectively contained in
+		// "True if among formattable nodes that are effectively contained in
 		// the active range, there are two that have distinct effective command
 		// values.  Otherwise false."
-		return getAllEffectivelyContainedNodes(getActiveRange(), function(node) {
-			return isEditable(node) && node.nodeType == Node.TEXT_NODE;
-		}).map(function(node) {
+		return getAllEffectivelyContainedNodes(getActiveRange(), isFormattableNode)
+		.map(function(node) {
 			return getEffectiveCommandValue(node, "fontsize");
 		}).filter(function(value, i, arr) {
 			return arr.slice(0, i).indexOf(value) == -1;
 		}).length >= 2;
 	}, value: function() {
-		// "Let pixel size be the effective command value of the first editable
-		// Text node that is effectively contained in the active range, or if
-		// there is no such node, the effective command value of the active
-		// range's start node, in either case interpreted as a number of
+		// "Let pixel size be the effective command value of the first
+		// formattable node that is effectively contained in the active range,
+		// or if there is no such node, the effective command value of the
+		// active range's start node, in either case interpreted as a number of
 		// pixels."
-		var node = getAllEffectivelyContainedNodes(getActiveRange(), function(node) {
-			return isEditable(node) && node.nodeType == Node.TEXT_NODE;
-		})[0];
+		var node = getAllEffectivelyContainedNodes(getActiveRange(), isFormattableNode)[0];
 		if (node === undefined) {
 			node = getActiveRange().startContainer;
 		}
@@ -3523,15 +3531,13 @@
 			setSelectionValue("subscript", "subscript");
 		}
 	}, indeterm: function() {
-		// "True if either among editable Text nodes that are effectively
+		// "True if either among formattable nodes that are effectively
 		// contained in the active range, there is at least one with effective
 		// command value "subscript" and at least one with some other effective
-		// command value; or if there is some editable Text node effectively
+		// command value; or if there is some formattable node effectively
 		// contained in the active range with effective command value "mixed".
 		// Otherwise false."
-		var nodes = getAllEffectivelyContainedNodes(getActiveRange(), function(node) {
-			return isEditable(node) && node.nodeType == Node.TEXT_NODE;
-		});
+		var nodes = getAllEffectivelyContainedNodes(getActiveRange(), isFormattableNode);
 		return (nodes.some(function(node) { return getEffectiveCommandValue(node, "subscript") == "subscript" })
 			&& nodes.some(function(node) { return getEffectiveCommandValue(node, "subscript") != "subscript" }))
 			|| nodes.some(function(node) { return getEffectiveCommandValue(node, "subscript") == "mixed" });
@@ -3555,16 +3561,13 @@
 			setSelectionValue("superscript", "superscript");
 		}
 	}, indeterm: function() {
-		// "True if either among editable Text nodes that are effectively
+		// "True if either among formattable nodes that are effectively
 		// contained in the active range, there is at least one with effective
 		// command value "superscript" and at least one with some other
-		// effective command value; or if there is some editable Text node
+		// effective command value; or if there is some formattable node
 		// effectively contained in the active range with effective command
 		// value "mixed".  Otherwise false."
-		var nodes = getAllEffectivelyContainedNodes(getActiveRange(),
-				function(node) {
-			return isEditable(node) && node.nodeType == Node.TEXT_NODE;
-		});
+		var nodes = getAllEffectivelyContainedNodes(getActiveRange(), isFormattableNode);
 		return (nodes.some(function(node) { return getEffectiveCommandValue(node, "superscript") == "superscript" })
 			&& nodes.some(function(node) { return getEffectiveCommandValue(node, "superscript") != "superscript" }))
 			|| nodes.some(function(node) { return getEffectiveCommandValue(node, "superscript") == "mixed" });
@@ -4189,10 +4192,10 @@
 	// initially empty."
 	var overrides = [];
 
-	// "Let node be the first editable Text node effectively contained in the
+	// "Let node be the first formattable node effectively contained in the
 	// active range, or null if there is none."
 	var node = getAllEffectivelyContainedNodes(getActiveRange())
-		.filter(function(node) { return isEditable(node) && node.nodeType == Node.TEXT_NODE })[0];
+		.filter(isFormattableNode)[0];
 
 	// "If node is null, return overrides."
 	if (!node) {
@@ -4233,10 +4236,10 @@
 }
 
 function restoreStatesAndValues(overrides) {
-	// "Let node be the first editable Text node effectively contained in the
+	// "Let node be the first formattable node effectively contained in the
 	// active range, or null if there is none."
 	var node = getAllEffectivelyContainedNodes(getActiveRange())
-		.filter(function(node) { return isEditable(node) && node.nodeType == Node.TEXT_NODE })[0];
+		.filter(isFormattableNode)[0];
 
 	// "If node is not null, then for each (command, override) pair in
 	// overrides, in order:"
@@ -4309,10 +4312,10 @@
 				continue;
 			}
 
-			// "Set node to the first editable Text node effectively contained
-			// in the active range, if there is one."
+			// "Set node to the first formattable node effectively contained in
+			// the active range, if there is one."
 			node = getAllEffectivelyContainedNodes(getActiveRange())
-				.filter(function(node) { return isEditable(node) && node.nodeType == Node.TEXT_NODE })[0]
+				.filter(isFormattableNode)[0]
 				|| node;
 		}
 
@@ -7909,19 +7912,17 @@
 		commands[command].relevantCssProperty = null;
 	}
 
-	// "If a command has inline command activated values defined but
-	// nothing else defines when it is indeterminate, it is indeterminate
-	// if among editable Text nodes effectively contained in the active
-	// range, there is at least one whose effective command value is one of
-	// the given values and at least one whose effective command value is
-	// not one of the given values."
+	// "If a command has inline command activated values defined but nothing
+	// else defines when it is indeterminate, it is indeterminate if among
+	// formattable nodes effectively contained in the active range, there is at
+	// least one whose effective command value is one of the given values and
+	// at least one whose effective command value is not one of the given
+	// values."
 	if ("inlineCommandActivatedValues" in commands[command]
 	&& !("indeterm" in commands[command])) {
 		commands[command].indeterm = function() {
-			var values = getAllEffectivelyContainedNodes(getActiveRange(), function(node) {
-				return isEditable(node)
-					&& node.nodeType == Node.TEXT_NODE;
-			}).map(function(node) { return getEffectiveCommandValue(node, command) });
+			var values = getAllEffectivelyContainedNodes(getActiveRange(), isFormattableNode)
+				.map(function(node) { return getEffectiveCommandValue(node, command) });
 
 			var matchingValues = values.filter(function(value) {
 				return commands[command].inlineCommandActivatedValues.indexOf(value) != -1;
@@ -7932,19 +7933,15 @@
 		};
 	}
 
-	// "If a command has inline command activated values defined, its state
-	// is true if either no editable Text node is effectively contained in
-	// the active range, and the active range's start node's effective
-	// command value is one of the given values; or if there is at least
-	// one editable Text node effectively contained in the active range,
-	// and all of them have an effective command value equal to one of the
-	// given values."
+	// "If a command has inline command activated values defined, its state is
+	// true if either no formattable node is effectively contained in the
+	// active range, and the active range's start node's effective command
+	// value is one of the given values; or if there is at least one
+	// formattable node effectively contained in the active range, and all of
+	// them have an effective command value equal to one of the given values."
 	if ("inlineCommandActivatedValues" in commands[command]) {
 		commands[command].state = function() {
-			var nodes = getAllEffectivelyContainedNodes(getActiveRange(), function(node) {
-				return isEditable(node)
-					&& node.nodeType == Node.TEXT_NODE;
-			});
+			var nodes = getAllEffectivelyContainedNodes(getActiveRange(), isFormattableNode);
 
 			if (nodes.length == 0) {
 				return commands[command].inlineCommandActivatedValues
@@ -7958,17 +7955,16 @@
 		};
 	}
 
-	// "If a command is a standard inline value command, it is
-	// indeterminate if among editable Text nodes that are effectively
-	// contained in the active range, there are two that have distinct
-	// effective command values. Its value is the effective command value
-	// of the first editable Text node that is effectively contained in the
-	// active range, or if there is no such node, the effective command
-	// value of the active range's start node."
+	// "If a command is a standard inline value command, it is indeterminate if
+	// among formattable nodes that are effectively contained in the active
+	// range, there are two that have distinct effective command values. Its
+	// value is the effective command value of the first formattable node that
+	// is effectively contained in the active range, or if there is no such
+	// node, the effective command value of the active range's start node."
 	if ("standardInlineValueCommand" in commands[command]) {
 		commands[command].indeterm = function() {
 			var values = getAllEffectivelyContainedNodes(getActiveRange())
-				.filter(function(node) { return isEditable(node) && node.nodeType == Node.TEXT_NODE })
+				.filter(isFormattableNode)
 				.map(function(node) { return getEffectiveCommandValue(node, command) });
 			for (var i = 1; i < values.length; i++) {
 				if (values[i] != values[i - 1]) {
--- a/source.html	Wed Sep 21 11:18:04 2011 -0600
+++ b/source.html	Mon Sep 19 15:35:44 2011 -0600
@@ -1882,6 +1882,9 @@
 command</span> will not remove it: it will nest <code title>&lt;span
 style="font-style: normal"></code> inside.
 
+<p>A <dfn>formattable node</dfn> is an <span>editable</span>
+<span>visible</span> [[text]] node.
+
 <p>Two quantities are <dfn>equivalent values</dfn> for a <span>command</span>
 if either both are null, or both are strings and they're equal and the
 <span>command</span> does not define any <span>equivalent values</span>, or
@@ -1907,11 +1910,11 @@
 
 <p>If a <span>command</span> has <dfn>inline command activated values</dfn>
 defined but nothing else defines when it is <span>indeterminate</span>, it is
-<span>indeterminate</span> if among <span>editable</span> [[text]] nodes
-<span>effectively contained</span> in the <span>active range</span>, there is
-at least one whose <span>effective command value</span> is one of the given
-values and at least one whose <span>effective command value</span> is not one
-of the given values.
+<span>indeterminate</span> if among <span title="formattable node">formattable
+nodes</span> <span>effectively contained</span> in the <span>active
+range</span>, there is at least one whose <span>effective command value</span>
+is one of the given values and at least one whose <span>effective command
+value</span> is not one of the given values.
 
 <p class=comments>For bold and similar commands, IE 9 RC seems to consider the
 state true or false depending on the first element.  All other browsers follow
@@ -1924,13 +1927,13 @@
 in all cases with a few exceptions.
 
 <p>If a <span>command</span> has <span>inline command activated values</span>
-defined, its <span>state</span> is true if either no <span>editable</span>
-[[text]] node is <span>effectively contained</span> in the <span>active
+defined, its <span>state</span> is true if either no <span>formattable
+node</span> is <span>effectively contained</span> in the <span>active
 range</span>, and the <span>active range</span>'s [[startnode]]'s
 <span>effective command value</span> is one of the given values; or if there is
-at least one <span>editable</span> [[text]] node <span>effectively
-contained</span> in the <span>active range</span>, and all of them have an
-<span>effective command value</span> equal to one of the given values.
+at least one <span>formattable node</span> <span>effectively contained</span>
+in the <span>active range</span>, and all of them have an <span>effective
+command value</span> equal to one of the given values.
 
 <div class=comments>
 <p>Testing with hiliteColor: Opera 11.11 seems to always return the effective
@@ -1948,13 +1951,13 @@
 </div>
 
 <p>If a command is a <dfn>standard inline value command</dfn>, it is
-<span>indeterminate</span> if among <span>editable</span> [[text]] nodes that
-are <span>effectively contained</span> in the <span>active range</span>, there
-are two that have distinct <span title="effective command value">effective
-command values</span>.  Its <span>value</span> is the <span>effective command
-value</span> of the first <span>editable</span> [[text]] node that is
-<span>effectively contained</span> in the <span>active range</span>, or if
-there is no such node, the <span>effective command value</span> of the
+<span>indeterminate</span> if among <span title="formattable node">formattable
+nodes</span> that are <span>effectively contained</span> in the <span>active
+range</span>, there are two that have distinct <span title="effective command
+value">effective command values</span>.  Its <span>value</span> is the
+<span>effective command value</span> of the first <span>formattable node</span>
+that is <span>effectively contained</span> in the <span>active range</span>, or
+if there is no such node, the <span>effective command value</span> of the
 <span>active range</span>'s [[startnode]].
 
 <p class=note>The effective command value of the active range's start node
@@ -2544,6 +2547,12 @@
     otherwise, and with <var>new parent instructions</var> returning null.
   </ol>
 
+  <li>
+  <p class=comments><a
+  href=http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996>Bug 13996</a>.
+
+  <p>If <var>node</var> is <span>invisible</span>, abort this algorithm.
+
   <li>If the <span>effective command value</span> of <var>command</var> is
   [[looselyequivalent]] to <var>new value</var> on <var>node</var>, abort this
   algorithm.
@@ -2906,7 +2915,7 @@
   general behavior: change the state/value, and then make sure that takes
   effect if the user types something before changing the cursor position.
 
-  <p>If there is no <span>editable</span> [[text]] node <span>effectively
+  <p>If there is no <span>formattable node</span> <span>effectively
   contained</span> in the <span>active range</span>:
 
   <ol>
@@ -3382,10 +3391,11 @@
 but for the selection to still be indeterminate.  Setting the fontSize to the
 value will make it determinate without changing anything's value.
 
-<p><span>Indeterminate</span>: True if among <span>editable</span> [[text]]
-nodes that are <span>effectively contained</span> in the <span>active
-range</span>, there are two that have distinct <span title="effective command
-value">effective command values</span>.  Otherwise false.
+<p><span>Indeterminate</span>: True if among <span title="formattable
+node">formattable nodes</span> that are <span>effectively contained</span> in
+the <span>active range</span>, there are two that have distinct <span
+title="effective command value">effective command values</span>.  Otherwise
+false.
 
 <div class=comments>
 <dl>
@@ -3424,7 +3434,7 @@
   decided on this choice of node.
 
   <p>Let <var>pixel size</var> be the <span>effective command value</span> of
-  the first <span>editable</span> [[text]] node that is <span>effectively
+  the first <span>formattable node</span> that is <span>effectively
   contained</span> in the <span>active range</span>, or if there is no such
   node, the <span>effective command value</span> of the <span>active
   range</span>'s [[startnode]], in either case interpreted as a number of
@@ -3825,13 +3835,13 @@
   "subscript".
 </ol>
 
-<p><span>Indeterminate</span>: True if either among <span>editable</span>
-[[text]] nodes that are <span>effectively contained</span> in the <span>active
-range</span>, there is at least one with <span>effective command value</span>
-"subscript" and at least one with some other <span>effective command
-value</span>; or if there is some <span>editable</span> [[text]] node
-<span>effectively contained</span> in the <span>active range</span> with
-<span>effective command value</span> "mixed".  Otherwise false.
+<p><span>Indeterminate</span>: True if either among <span title="formattable
+node">formattable nodes</span> that are <span>effectively contained</span> in
+the <span>active range</span>, there is at least one with <span>effective
+command value</span> "subscript" and at least one with some other
+<span>effective command value</span>; or if there is some <span>formattable
+node</span> <span>effectively contained</span> in the <span>active range</span>
+with <span>effective command value</span> "mixed".  Otherwise false.
 
 <p class=comments> For &lt;sup>&lt;sub>foo&lt;/sub>&lt;/sup>, Firefox 6.0a2 and
 Opera 11.11 say the state is true for both superscript and subscript, and
@@ -3862,13 +3872,13 @@
   "superscript".
 </ol>
 
-<p><span>Indeterminate</span>: True if either among <span>editable</span>
-[[text]] nodes that are <span>effectively contained</span> in the <span>active
-range</span>, there is at least one with <span>effective command value</span>
-"superscript" and at least one with some other <span>effective command
-value</span>; or if there is some <span>editable</span> [[text]] node
-<span>effectively contained</span> in the <span>active range</span> with
-<span>effective command value</span> "mixed".  Otherwise false.
+<p><span>Indeterminate</span>: True if either among <span title="formattable
+node">formattable nodes</span> that are <span>effectively contained</span> in
+the <span>active range</span>, there is at least one with <span>effective
+command value</span> "superscript" and at least one with some other
+<span>effective command value</span>; or if there is some <span>formattable
+node</span> <span>effectively contained</span> in the <span>active range</span>
+with <span>effective command value</span> "mixed".  Otherwise false.
 
 <p><span>Inline command activated values</span>: "superscript"
 
@@ -4484,7 +4494,7 @@
   <li>Let <var>overrides</var> be a list of (string, string or boolean) ordered
   pairs, initially empty.
 
-  <li>Let <var>node</var> be the first <span>editable</span> [[text]] node
+  <li>Let <var>node</var> be the first <span>formattable node</span>
   <span>effectively contained</span> in the <span>active range</span>, or null
   if there is none.
 
@@ -4495,9 +4505,9 @@
 
   <li>
   <p class=comments>Thus we will set state overrides based on the first
-  editable text node, to match values.  This means that if you have
-  &lt;p>foo&lt;b>[bar&lt;/b>baz]&lt;/p> and hit backspace and hit A, you'll get
-  &lt;p>foo&lt;b>a[]&lt;/b>&lt;/p>, although bold was previously indeterminate.
+  formattable node, to match values.  This means that if you have
+  {{code|<p>foo<b>[bar</b>baz]</p>}} and hit backspace and hit A, you'll get
+  {{code|<p>foo<b>a[]</b></p>}}, although bold was previously indeterminate.
   This is needed to match the behavior of hitting A straight away, since
   innerText doesn't strip wrappers when it invokes "delete the contents".
 
@@ -4532,7 +4542,7 @@
 <span>record current states and values</span> algorithm:
 
 <ol>
-  <li>Let <var>node</var> be the first <span>editable</span> [[text]] node
+  <li>Let <var>node</var> be the first <span>formattable node</span>
   <span>effectively contained</span> in the <span>active range</span>, or null
   if there is none.
 
@@ -4592,7 +4602,7 @@
     selection was {{code|foo[bar]baz}}, the text node could have been split so
     that the first part is now outside the active range.
 
-    <p>Set <var>node</var> to the first <span>editable</span> [[text]] node
+    <p>Set <var>node</var> to the first <span>formattable node</span>
     <span>effectively contained</span> in the <span>active range</span>, if
     there is one.
   </ol>
--- a/tests.js	Wed Sep 21 11:18:04 2011 -0600
+++ b/tests.js	Mon Sep 19 15:35:44 2011 -0600
@@ -86,11 +86,16 @@
 	bold: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
 		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
 		'foo[bar]baz',
+		'foo[bar<b>baz]qoz</b>quz',
 		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
 
 		'foo<span contenteditable=false>[bar]</span>baz',
 		'fo[o<span contenteditable=false>bar</span>b]az',
@@ -223,12 +228,16 @@
 	createlink: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
 		'foo[bar]baz',
-		'foo]bar[baz',
-		// http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996
-		'!{<p><p> <p>foo</p>}',
+		'foo[bar<b>baz]qoz</b>quz',
+		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
 
 		'<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>',
 		'<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>',
@@ -628,12 +637,16 @@
 	fontname: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
 		'foo[bar]baz',
-		'foo]bar[baz',
-		// http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996
-		'!{<p><p> <p>foo</p>}',
+		'foo[bar<b>baz]qoz</b>quz',
+		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
 
 		'<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>',
 		'<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>',
@@ -711,8 +724,17 @@
 	fontsize: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
+		'foo[bar]baz',
+		'foo[bar<b>baz]qoz</b>quz',
+		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
+
 		["1", 'foo[bar]baz'],
 		["0", 'foo[bar]baz'],
 		["-5", 'foo[bar]baz'],
@@ -737,10 +759,6 @@
 		["-9", 'foo[bar]baz'],
 		["", 'foo[bar]baz'],
 
-		// http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996
-		'!{<p><p> <p>foo</p>}',
-		'foo[bar<i>baz]qoz</i>quz',
-
 		'<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>',
 		'<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>',
 		'<table><tbody><tr data-start=0 data-end=2><td>foo<td>bar<td>baz</table>',
@@ -813,13 +831,16 @@
 	forecolor: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
 		'foo[bar]baz',
-		'foo]bar[baz',
-		// http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996
-		'!{<p><p> <p>foo</p>}',
+		'foo[bar<b>baz]qoz</b>quz',
 		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
 
 		['blue', 'foo[bar]baz'],
 		['f', 'foo[bar]baz'],
@@ -1475,13 +1496,16 @@
 	hilitecolor: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
 		'foo[bar]baz',
-		'foo]bar[baz',
-		// http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996
-		'!{<p><p> <p>foo</p>}',
+		'foo[bar<b>baz]qoz</b>quz',
 		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
 
 		'<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>',
 		'<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>',
@@ -2516,13 +2540,16 @@
 	italic: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
 		'foo[bar]baz',
-		'foo]bar[baz',
-		// http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996
-		'!{<p><p> <p>foo</p>}',
 		'foo[bar<b>baz]qoz</b>quz',
+		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
 
 		'<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>',
 		'<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>',
@@ -3256,13 +3283,16 @@
 	strikethrough: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
 		'foo[bar]baz',
-		'foo]bar[baz',
-		// http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996
-		'!{<p><p> <p>foo</p>}',
 		'foo[bar<b>baz]qoz</b>quz',
+		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
 
 		'<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>',
 		'<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>',
@@ -3348,10 +3378,16 @@
 	subscript: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
 		'foo[bar]baz',
 		'foo[bar<b>baz]qoz</b>quz',
+		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
 
 		'<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>',
 		'<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>',
@@ -3399,10 +3435,16 @@
 	superscript: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
 		'foo[bar]baz',
 		'foo[bar<b>baz]qoz</b>quz',
+		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
 
 		'<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>',
 		'<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>',
@@ -3453,13 +3495,16 @@
 	underline: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
 		'foo[bar]baz',
-		'foo]bar[baz',
-		// http://www.w3.org/Bugs/Public/show_bug.cgi?id=13996
-		'!{<p><p> <p>foo</p>}',
 		'foo[bar<b>baz]qoz</b>quz',
+		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
 
 		'<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>',
 		'<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>',
@@ -3545,8 +3590,17 @@
 	unlink: [
 	//@{
 		'foo[]bar',
+		'<p>[foo</p> <p>bar]</p>',
+		'<p>[foo</p><p> <span>bar</span> </p><p>baz]</p>',
+		'<b>foo[]bar</b>',
+		'<i>foo[]bar</i>',
 		'<span>foo</span>{}<span>bar</span>',
 		'<span>foo[</span><span>]bar</span>',
+		'foo[bar]baz',
+		'foo[bar<b>baz]qoz</b>quz',
+		'foo[bar<i>baz]qoz</i>quz',
+		'{<p><p> <p>foo</p>}',
+
 		'<a href=http://www.google.com/>foo[bar]baz</a>',
 		'<a href=http://www.google.com/>foo[barbaz</a>}',
 		'{<a href=http://www.google.com/>foobar]baz</a>',