Lots of new whitespace tests
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Thu, 22 Sep 2011 13:53:40 -0600
changeset 617 89fed05c54e0
parent 616 41bd940dbc7e
child 618 e60077322f8a
Lots of new whitespace tests

Many have incorrect results, to be fixed in the next commit. This way
it's clear from the diff what the actual changes are to the test
results.
conformancetest/data.js
tests.js
--- a/conformancetest/data.js	Thu Sep 22 11:54:31 2011 -0600
+++ b/conformancetest/data.js	Thu Sep 22 13:53:40 2011 -0600
@@ -2071,6 +2071,22 @@
 	[["stylewithcss","true"],["delete",""]],
 	"fo[]<a href=\"/\" name=\"abc\">bar</a>",
 	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["foo &nbsp;[]",
+	[["stylewithcss","false"],["delete",""]],
+	"foo&nbsp;[]",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["foo &nbsp;[]",
+	[["stylewithcss","true"],["delete",""]],
+	"foo&nbsp;[]",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["&nbsp;[] foo",
+	[["stylewithcss","false"],["delete",""]],
+	"{}&nbsp;foo",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["&nbsp;[] foo",
+	[["stylewithcss","true"],["delete",""]],
+	"{}&nbsp;foo",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
 ["foo &nbsp;[]bar",
 	[["stylewithcss","false"],["delete",""]],
 	"foo []bar",
@@ -2103,6 +2119,54 @@
 	[["stylewithcss","true"],["delete",""]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["foo []&nbsp; bar",
+	[["stylewithcss","false"],["delete",""]],
+	"foo[]&nbsp; bar",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["foo []&nbsp; bar",
+	[["stylewithcss","true"],["delete",""]],
+	"foo[]&nbsp; bar",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["foo &nbsp;[] bar",
+	[["stylewithcss","false"],["delete",""]],
+	"foo []bar",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["foo &nbsp;[] bar",
+	[["stylewithcss","true"],["delete",""]],
+	"foo []bar",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["foo &nbsp; []bar",
+	[["stylewithcss","false"],["delete",""]],
+	"foo&nbsp; []bar",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["foo &nbsp; []bar",
+	[["stylewithcss","true"],["delete",""]],
+	"foo&nbsp; []bar",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["foo []<span>&nbsp;</span> bar",
+	[["stylewithcss","false"],["delete",""]],
+	"foo[]<span>&nbsp;</span> bar",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["foo []<span>&nbsp;</span> bar",
+	[["stylewithcss","true"],["delete",""]],
+	"foo[]<span>&nbsp;</span> bar",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["foo <span>&nbsp;</span>[] bar",
+	[["stylewithcss","false"],["delete",""]],
+	"foo {}bar",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["foo <span>&nbsp;</span>[] bar",
+	[["stylewithcss","true"],["delete",""]],
+	"foo {}bar",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["foo <span>&nbsp;</span> []bar",
+	[["stylewithcss","false"],["delete",""]],
+	"foo&nbsp;<span> </span>{}bar",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["foo <span>&nbsp;</span> []bar",
+	[["stylewithcss","true"],["delete",""]],
+	"foo&nbsp;<span> </span>{}bar",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
 ["<b>foo </b>&nbsp;[]bar",
 	[["stylewithcss","false"],["delete",""]],
 	"<b>foo </b>{}bar",
@@ -2135,6 +2199,14 @@
 	[["stylewithcss","true"],["delete",""]],
 	"<b>foo[]</b>bar",
 	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["<p>foo </p><p>[] bar</p>",
+	[["stylewithcss","false"],["delete",""]],
+	"<p>foo&nbsp;{}&nbsp;bar</p>",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["<p>foo </p><p>[] bar</p>",
+	[["stylewithcss","true"],["delete",""]],
+	"<p>foo&nbsp;{}&nbsp;bar</p>",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
 ["foo<table><tr><td>[]bar</table>baz",
 	[["stylewithcss","false"],["delete",""]],
 	"foo<table><tbody><tr><td>[]bar</td></tr></tbody></table>baz",
@@ -3831,6 +3903,30 @@
 	[["stylewithcss","true"],["delete",""]],
 	"<b>foo&nbsp;[]</b>",
 	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["foo<b> [&nbsp;bar]</b>",
+	[["stylewithcss","false"],["delete",""]],
+	"foo<b> []</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["foo<b> [&nbsp;bar]</b>",
+	[["stylewithcss","true"],["delete",""]],
+	"foo<b> []</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["<b>[foo&nbsp;] </b>bar",
+	[["stylewithcss","false"],["delete",""]],
+	"<b>{}&nbsp;</b>bar",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["<b>[foo&nbsp;] </b>bar",
+	[["stylewithcss","true"],["delete",""]],
+	"<b>{}&nbsp;</b>bar",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
+["[foo<b>&nbsp;] bar</b>",
+	[["stylewithcss","false"],["delete",""]],
+	"{}<b>&nbsp;bar</b>",
+	{"stylewithcss":[false,true,"",false,false,""],"delete":[false,false,"",false,false,""]}],
+["[foo<b>&nbsp;] bar</b>",
+	[["stylewithcss","true"],["delete",""]],
+	"{}<b>&nbsp;bar</b>",
+	{"stylewithcss":[false,false,"",false,true,""],"delete":[false,false,"",false,false,""]}],
 ["<p style=display:inline>fo[o<p style=display:inline>b]ar",
 	[["stylewithcss","false"],["delete",""]],
 	"<p style=\"display:inline\">fo[]</p><p style=\"display:inline\">ar</p>",
@@ -8151,6 +8247,22 @@
 	[["stylewithcss","true"],["forwarddelete",""]],
 	"<a href=\"/\" name=\"abc\">foo</a>{}ar",
 	{"stylewithcss":[false,false,"",false,true,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo []&nbsp;",
+	[["stylewithcss","false"],["forwarddelete",""]],
+	"foo&nbsp;[]",
+	{"stylewithcss":[false,true,"",false,false,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo []&nbsp;",
+	[["stylewithcss","true"],["forwarddelete",""]],
+	"foo&nbsp;[]",
+	{"stylewithcss":[false,false,"",false,true,""],"forwarddelete":[false,false,"",false,false,""]}],
+["[]&nbsp; foo",
+	[["stylewithcss","false"],["forwarddelete",""]],
+	"{}&nbsp;foo",
+	{"stylewithcss":[false,true,"",false,false,""],"forwarddelete":[false,false,"",false,false,""]}],
+["[]&nbsp; foo",
+	[["stylewithcss","true"],["forwarddelete",""]],
+	"{}&nbsp;foo",
+	{"stylewithcss":[false,false,"",false,true,""],"forwarddelete":[false,false,"",false,false,""]}],
 ["foo[] &nbsp;bar",
 	[["stylewithcss","false"],["forwarddelete",""]],
 	"foo[] bar",
@@ -8183,6 +8295,54 @@
 	[["stylewithcss","true"],["forwarddelete",""]],
 	"foo[]bar",
 	{"stylewithcss":[false,false,"",false,true,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo[] &nbsp; bar",
+	[["stylewithcss","false"],["forwarddelete",""]],
+	"foo[]&nbsp; bar",
+	{"stylewithcss":[false,true,"",false,false,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo[] &nbsp; bar",
+	[["stylewithcss","true"],["forwarddelete",""]],
+	"foo[]&nbsp; bar",
+	{"stylewithcss":[false,false,"",false,true,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo []&nbsp; bar",
+	[["stylewithcss","false"],["forwarddelete",""]],
+	"foo []bar",
+	{"stylewithcss":[false,true,"",false,false,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo []&nbsp; bar",
+	[["stylewithcss","true"],["forwarddelete",""]],
+	"foo []bar",
+	{"stylewithcss":[false,false,"",false,true,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo &nbsp;[] bar",
+	[["stylewithcss","false"],["forwarddelete",""]],
+	"foo&nbsp; []bar",
+	{"stylewithcss":[false,true,"",false,false,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo &nbsp;[] bar",
+	[["stylewithcss","true"],["forwarddelete",""]],
+	"foo&nbsp; []bar",
+	{"stylewithcss":[false,false,"",false,true,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo[] <span>&nbsp;</span> bar",
+	[["stylewithcss","false"],["forwarddelete",""]],
+	"foo[]<span>&nbsp;</span> bar",
+	{"stylewithcss":[false,true,"",false,false,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo[] <span>&nbsp;</span> bar",
+	[["stylewithcss","true"],["forwarddelete",""]],
+	"foo[]<span>&nbsp;</span> bar",
+	{"stylewithcss":[false,false,"",false,true,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo []<span>&nbsp;</span> bar",
+	[["stylewithcss","false"],["forwarddelete",""]],
+	"foo {}bar",
+	{"stylewithcss":[false,true,"",false,false,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo []<span>&nbsp;</span> bar",
+	[["stylewithcss","true"],["forwarddelete",""]],
+	"foo {}bar",
+	{"stylewithcss":[false,false,"",false,true,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo <span>&nbsp;</span>[] bar",
+	[["stylewithcss","false"],["forwarddelete",""]],
+	"foo&nbsp;<span> </span>{}bar",
+	{"stylewithcss":[false,true,"",false,false,""],"forwarddelete":[false,false,"",false,false,""]}],
+["foo <span>&nbsp;</span>[] bar",
+	[["stylewithcss","true"],["forwarddelete",""]],
+	"foo&nbsp;<span> </span>{}bar",
+	{"stylewithcss":[false,false,"",false,true,""],"forwarddelete":[false,false,"",false,false,""]}],
 ["<b>foo[] </b>&nbsp;bar",
 	[["stylewithcss","false"],["forwarddelete",""]],
 	"<b>foo[]</b> bar",
@@ -16855,6 +17015,70 @@
 	[["stylewithcss","true"],["inserttext","a"]],
 	"<blockquote><font color=\"blue\">a[]</font></blockquote>",
 	{"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
+["foo[] ",
+	[["stylewithcss","false"],["inserttext"," "]],
+	"foo []&nbsp;",
+	{"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
+["foo[] ",
+	[["stylewithcss","true"],["inserttext"," "]],
+	"foo []&nbsp;",
+	{"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
+[" foo   []   ",
+	[["stylewithcss","false"],["inserttext"," "]],
+	" foo &nbsp;[]&nbsp;",
+	{"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
+[" foo   []   ",
+	[["stylewithcss","true"],["inserttext"," "]],
+	" foo &nbsp;[]&nbsp;",
+	{"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
+["foo[]<span> </span>",
+	[["stylewithcss","false"],["inserttext"," "]],
+	"foo&nbsp;[]<span> </span>",
+	{"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
+["foo[]<span> </span>",
+	[["stylewithcss","true"],["inserttext"," "]],
+	"foo&nbsp;[]<span> </span>",
+	{"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
+["foo[]<span> </span> ",
+	[["stylewithcss","false"],["inserttext"," "]],
+	"foo&nbsp;[]<span> </span> ",
+	{"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
+["foo[]<span> </span> ",
+	[["stylewithcss","true"],["inserttext"," "]],
+	"foo&nbsp;[]<span> </span> ",
+	{"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
+[" []foo",
+	[["stylewithcss","false"],["inserttext"," "]],
+	"&nbsp; []foo",
+	{"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
+[" []foo",
+	[["stylewithcss","true"],["inserttext"," "]],
+	"&nbsp; []foo",
+	{"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
+["   []   foo ",
+	[["stylewithcss","false"],["inserttext"," "]],
+	"&nbsp;&nbsp;[] foo ",
+	{"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
+["   []   foo ",
+	[["stylewithcss","true"],["inserttext"," "]],
+	"&nbsp;&nbsp;[] foo ",
+	{"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
+["<span> </span>[]foo",
+	[["stylewithcss","false"],["inserttext"," "]],
+	"<span> </span>&nbsp;[]foo",
+	{"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
+["<span> </span>[]foo",
+	[["stylewithcss","true"],["inserttext"," "]],
+	"<span> </span>&nbsp;[]foo",
+	{"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
+[" <span> </span>[]foo",
+	[["stylewithcss","false"],["inserttext"," "]],
+	" <span> </span>&nbsp;[]foo",
+	{"stylewithcss":[false,true,"",false,false,""],"inserttext":[false,false,"",false,false,""]}],
+[" <span> </span>[]foo",
+	[["stylewithcss","true"],["inserttext"," "]],
+	" <span> </span>&nbsp;[]foo",
+	{"stylewithcss":[false,false,"",false,true,""],"inserttext":[false,false,"",false,false,""]}],
 ["foo[]bar",
 	[["stylewithcss","false"],["insertunorderedlist",""]],
 	"<ul><li>foo[]bar</li></ul>",
--- a/tests.js	Thu Sep 22 11:54:31 2011 -0600
+++ b/tests.js	Thu Sep 22 13:53:40 2011 -0600
@@ -355,14 +355,23 @@
 		'foo<a name=abc>[]bar</a>',
 		'foo<a href=/ name=abc>[]bar</a>',
 
+		'foo &nbsp;[]',
+		'&nbsp;[] foo',
 		'foo &nbsp;[]bar',
 		'foo&nbsp; []bar',
 		'foo&nbsp;&nbsp;[]bar',
 		'foo  []bar',
+		'foo []&nbsp; bar',
+		'foo &nbsp;[] bar',
+		'foo &nbsp; []bar',
+		'foo []<span>&nbsp;</span> bar',
+		'foo <span>&nbsp;</span>[] bar',
+		'foo <span>&nbsp;</span> []bar',
 		'<b>foo </b>&nbsp;[]bar',
 		'<b>foo&nbsp;</b> []bar',
 		'<b>foo&nbsp;</b>&nbsp;[]bar',
 		'<b>foo </b> []bar',
+		'<p>foo </p><p>[] bar</p>',
 
 		// Tables with collapsed selection
 		'foo<table><tr><td>[]bar</table>baz',
@@ -615,6 +624,9 @@
 		'<dl><dt>foo<dd>bar[<dd>]baz</dl>',
 
 		'<b>foo [&nbsp;</b>bar]',
+		'foo<b> [&nbsp;bar]</b>',
+		'<b>[foo&nbsp;] </b>bar',
+		'[foo<b>&nbsp;] bar</b>',
 
 		// Do we merge based on element names or the display property?
 		'<p style=display:inline>fo[o<p style=display:inline>b]ar',
@@ -1257,10 +1269,18 @@
 		'<a name=abc>foo[]</a>bar',
 		'<a href=/ name=abc>foo[]</a>bar',
 
+		'foo []&nbsp;',
+		'[]&nbsp; foo',
 		'foo[] &nbsp;bar',
 		'foo[]&nbsp; bar',
 		'foo[]&nbsp;&nbsp;bar',
 		'foo[]  bar',
+		'foo[] &nbsp; bar',
+		'foo []&nbsp; bar',
+		'foo &nbsp;[] bar',
+		'foo[] <span>&nbsp;</span> bar',
+		'foo []<span>&nbsp;</span> bar',
+		'foo <span>&nbsp;</span>[] bar',
 		'<b>foo[] </b>&nbsp;bar',
 		'<b>foo[]&nbsp;</b> bar',
 		'<b>foo[]&nbsp;</b>&nbsp;bar',
@@ -2430,6 +2450,17 @@
 
 		// https://bugs.webkit.org/show_bug.cgi?id=19702
 		'<blockquote><font color=blue>[foo]</font></blockquote>',
+
+		// http://www.w3.org/Bugs/Public/show_bug.cgi?id=14119
+		// https://bugzilla.mozilla.org/show_bug.cgi?id=681626
+		[' ', 'foo[] '],
+		[' ', ' foo   []   '],
+		[' ', 'foo[]<span> </span>'],
+		[' ', 'foo[]<span> </span> '],
+		[' ', ' []foo'],
+		[' ', '   []   foo '],
+		[' ', '<span> </span>[]foo'],
+		[' ', ' <span> </span>[]foo'],
 	],
 	//@}
 	insertunorderedlist: [