Bug 787432 - Don't strip existing empty wrappers when inserting text; r=ehsan a=akeybl
authorAryeh Gregor <ayg@aryeh.name>
Thu, 27 Sep 2012 14:39:39 +0200
changeset 109336 0ca632fe62890006d951dd2f5681217d5629d2c9
parent 109335 b1feef78e8c49ad0a5ee15a0b1216d663231e7ee
child 109337 1697327817af84be433c5c164fb3b2d98316b90f
push id1490
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 18:29:50 +0000
treeherdermozilla-beta@f335e7dacdc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, akeybl
bugs787432
milestone17.0a2
Bug 787432 - Don't strip existing empty wrappers when inserting text; r=ehsan a=akeybl
dom/imptests/failures/editing/conformancetest/Makefile.in
dom/imptests/failures/editing/conformancetest/test_runtest.html.json
editor/libeditor/html/nsHTMLEditRules.cpp
editor/libeditor/html/tests/Makefile.in
editor/libeditor/html/tests/test_bug787432.html
--- a/dom/imptests/failures/editing/conformancetest/Makefile.in
+++ b/dom/imptests/failures/editing/conformancetest/Makefile.in
@@ -1,18 +1,20 @@
-DEPTH = @DEPTH@
+# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
+
+DEPTH := @DEPTH@
 
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-DIRS = \
-  $(NULL)
+topsrcdir := @top_srcdir@
+srcdir := @srcdir@
+VPATH := @srcdir@
+relativesrcdir := @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-MOCHITEST_FILES = \
+DIRS := \
+  $(NULL)
+
+MOCHITEST_FILES := \
   test_event.html.json \
   test_runtest.html.json \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/failures/editing/conformancetest/test_runtest.html.json
+++ b/dom/imptests/failures/editing/conformancetest/test_runtest.html.json
@@ -2364,26 +2364,16 @@
   "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<h6>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<h6>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"formatblock\") before":true,
   "[[\"formatblock\",\"<ins>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"formatblock\") before":true,
   "[[\"formatblock\",\"<ins>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"formatblock\") after":true,
   "[[\"formatblock\",\"<li>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"formatblock\") before":true,
   "[[\"formatblock\",\"<li>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"formatblock\") after":true,
   "[[\"formatblock\",\"<ol>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"formatblock\") before":true,
   "[[\"formatblock\",\"<ol>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"formatblock\") after":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<p>\"]] \"<div>[foobar]</div>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<p>\"]] \"<div>[foobar]</div>\" compare innerHTML":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<p>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<p>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<p>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"formatblock\") before":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<p>\"]] \"<div>[foobar]</div>\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<p>\"]] \"<div>[foobar]</div>\" compare innerHTML":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<p>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<p>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<p>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"formatblock\") before":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<pre>\"]] \"<div>[foobar]</div>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<pre>\"]] \"<div>[foobar]</div>\" compare innerHTML":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<pre>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<pre>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<pre>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"formatblock\") before":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<pre>\"]] \"<div>[foobar]</div>\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<pre>\"]] \"<div>[foobar]</div>\" compare innerHTML":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<pre>\"]] \"<div>[foobar]</div>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
@@ -2404,24 +2394,16 @@
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<dd>\"]] \"<p>[foobar]</p>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<dd>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<dd>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<dd>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"formatblock\") after":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<dd>\"]] \"<p>[foobar]</p>\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<dd>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<dd>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<dd>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"formatblock\") after":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<div>\"]] \"<p>[foobar]</p>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<div>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<div>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<div>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"formatblock\") after":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<div>\"]] \"<p>[foobar]</p>\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<div>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<div>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<div>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"formatblock\") after":true,
   "[[\"formatblock\",\"<dl>\"]] \"<p>[foobar]</p>\": execCommand(\"formatblock\", false, \"<dl>\") return value":true,
   "[[\"formatblock\",\"<dl>\"]] \"<p>[foobar]</p>\" compare innerHTML":true,
   "[[\"formatblock\",\"<dl>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"formatblock\") after":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<dt>\"]] \"<p>[foobar]</p>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<dt>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<dt>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"formatblock\",\"<dt>\"]] \"<p>[foobar]</p>\" queryCommandValue(\"formatblock\") after":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"formatblock\",\"<dt>\"]] \"<p>[foobar]</p>\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
@@ -3900,22 +3882,16 @@
   "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"inserthorizontalrule\",\"\"]] \"<p>foo<b>b[a]r</b>baz</p>\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
   "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"inserthorizontalrule\",\"\"]] \"<p>foo<b>b[a]r</b>baz</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
   "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"inserthorizontalrule\",\"\"]] \"<p>foo<b>b[a]r</b>baz</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"inserthorizontalrule\",\"\"]] \"<address>foo[bar]baz</address>\" compare innerHTML":true,
   "[[\"inserthorizontalrule\",\"\"]] \"<bdi>foo[bar]baz</bdi>\" compare innerHTML":true,
   "[[\"inserthorizontalrule\",\"\"]] \"<table><caption>foo[bar]baz</caption><tr><td>quz</table>\": execCommand(\"inserthorizontalrule\", false, \"\") return value":true,
   "[[\"inserthorizontalrule\",\"\"]] \"<table><caption>foo[bar]baz</caption><tr><td>quz</table>\" compare innerHTML":true,
   "[[\"inserthorizontalrule\",\"\"]] \"<dl><dt>foo[bar]baz</dt></dl>\" compare innerHTML":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"inserthorizontalrule\",\"\"]] \"<p>foo[bar]baz</p>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"inserthorizontalrule\",\"\"]] \"<p>foo[bar]baz</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
-  "[[\"defaultparagraphseparator\",\"div\"],[\"inserthorizontalrule\",\"\"]] \"<p>foo[bar]baz</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"inserthorizontalrule\",\"\"]] \"<p>foo[bar]baz</p>\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"inserthorizontalrule\",\"\"]] \"<p>foo[bar]baz</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
-  "[[\"defaultparagraphseparator\",\"p\"],[\"inserthorizontalrule\",\"\"]] \"<p>foo[bar]baz</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"inserthorizontalrule\",\"\"]] \"<ruby>foo[bar]baz<rt>quz</rt></ruby>\" compare innerHTML":true,
   "[[\"inserthorizontalrule\",\"\"]] \"<ruby>foo<rt>bar[baz]quz</rt></ruby>\" compare innerHTML":true,
   "[[\"inserthorizontalrule\",\"\"]] \"<ruby>foo<rp>bar[baz]quz</rp><rt>qoz</rt><rp>qiz</rp></ruby>\" compare innerHTML":true,
   "[[\"inserthorizontalrule\",\"\"]] \"fo[o<span contenteditable=false>bar</span>b]az\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserthtml\",\"ab<b>c</b>d\"]] \"[foo<span style=color:#aBcDeF>bar]</span>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserthtml\",\"ab<b>c</b>d\"]] \"[foo<span style=color:#aBcDeF>bar]</span>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserthtml\",\"ab<b>c</b>d\"]] \"{foo<span style=color:#aBcDeF>bar}</span>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserthtml\",\"ab<b>c</b>d\"]] \"{foo<span style=color:#aBcDeF>bar}</span>baz\" compare innerHTML":true,
@@ -6497,57 +6473,40 @@
   "[[\"inserttext\",\" \"]] \"#@x[]\" compare innerHTML":true,
   "[[\"inserttext\",\" \"]] \"a@.[]\" compare innerHTML":true,
   "[[\"inserttext\",\" \"]] \"!\\\"#$%&amp;'()*+,-./:;&lt;=>?^_`|~a@b!\\\"#$%&amp;'()*+,-./:;&lt;=>?^_`|~[]\" compare innerHTML":true,
   "[[\"inserttext\",\" \"]] \"<b>a@b</b>{}\" compare innerHTML":true,
   "[[\"inserttext\",\" \"]] \"<b>a</b><i>@</i><u>b</u>{}\" compare innerHTML":true,
   "[[\"inserttext\",\" \"]] \"a@b<b>[]c</b>\" compare innerHTML":true,
   "[[\"inserttext\",\"\\t\"]] \"http://a[]\" compare innerHTML":true,
   "[[\"inserttext\",\"\\f\"]] \"http://a[]\" compare innerHTML":true,
-  "[[\"inserttext\",\" \"]] \"http://a[]\" compare innerHTML":true,
+  "[[\"inserttext\",\"\u00a0\"]] \"http://a[]\" compare innerHTML":true,
   "[[\"inserttext\",\"   \"]] \"foo[]\" compare innerHTML":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>b]ar\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>b]ar\" queryCommandValue(\"defaultparagraphseparator\") before":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>b]ar\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>b]ar\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>b]ar\" queryCommandValue(\"defaultparagraphseparator\") before":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>b]ar\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>bar<p>b]az\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>bar<p>b]az\" queryCommandValue(\"defaultparagraphseparator\") before":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>bar<p>b]az\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>bar<p>b]az\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>bar<p>b]az\" queryCommandValue(\"defaultparagraphseparator\") before":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"inserttext\",\"a\"]] \"<p>fo[o<p>bar<p>b]az\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"inserttext\",\"a\"]] \"{}<br>\" compare innerHTML":true,
   "[[\"inserttext\",\"a\"]] \"<p>{}<br>\" compare innerHTML":true,
   "[[\"inserttext\",\"a\"]] \"<p><span>{}<br></span>\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"<p>foo<span style=color:#aBcDeF>[bar]</span>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"<p>foo<span style=color:#aBcDeF>{bar}</span>baz\" compare innerHTML":true,
   "[[\"inserttext\",\"a\"]] \"<p>foo{<span style=color:#aBcDeF>bar</span>}baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"<p>[foo<span style=color:#aBcDeF>bar]</span>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"<p>[foo<span style=color:#aBcDeF>bar]</span>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"<p>{foo<span style=color:#aBcDeF>bar}</span>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"<p>{foo<span style=color:#aBcDeF>bar}</span>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"<p>foo<span style=color:#aBcDeF>{bar</span>baz}\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<s>[bar]</s>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<a href=http://www.google.com>[bar]</a>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font color=#0000FF>[bar]</font>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<span style=background-color:#00FFFF>[bar]</span>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<a href=http://www.google.com><font color=blue>[bar]</font></a>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font color=blue><a href=http://www.google.com>[bar]</a></font>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<a href=http://www.google.com><font color=brown>[bar]</font></a>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font color=brown><a href=http://www.google.com>[bar]</a></font>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<a href=http://www.google.com><font color=black>[bar]</font></a>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<a href=http://www.google.com><u>[bar]</u></a>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<u><a href=http://www.google.com>[bar]</a></u>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font size=2><sub>[bar]</sub></font>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font size=3><sub>[bar]</sub></font>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"[foo<b>bar]</b>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"[foo<b>bar]</b>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"[foo<i>bar]</i>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"[foo<i>bar]</i>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"[foo<s>bar]</s>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"[foo<s>bar]</s>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"[foo<sub>bar]</sub>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"[foo<sub>bar]</sub>baz\" compare innerHTML":true,
@@ -6581,38 +6540,16 @@
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"[foo<sub><font size=2>bar]</font></sub>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"[foo<sub><font size=2>bar]</font></sub>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"[foo<font size=2><sub>bar]</sub></font>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"[foo<font size=2><sub>bar]</sub></font>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"[foo<sub><font size=3>bar]</font></sub>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"[foo<sub><font size=3>bar]</font></sub>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"inserttext\",\"a\"]] \"[foo<font size=3><sub>bar]</sub></font>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"inserttext\",\"a\"]] \"[foo<font size=3><sub>bar]</sub></font>baz\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<b>[bar</b>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<i>[bar</i>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<s>[bar</s>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<sub>[bar</sub>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<sup>[bar</sup>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<u>[bar</u>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<a href=http://www.google.com>[bar</a>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font face=sans-serif>[bar</font>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font size=4>[bar</font>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font color=#0000FF>[bar</font>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<span style=background-color:#00FFFF>[bar</span>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<a href=http://www.google.com><font color=blue>[bar</font></a>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font color=blue><a href=http://www.google.com>[bar</a></font>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<a href=http://www.google.com><font color=brown>[bar</font></a>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font color=brown><a href=http://www.google.com>[bar</a></font>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<a href=http://www.google.com><font color=black>[bar</font></a>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<a href=http://www.google.com><u>[bar</u></a>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<u><a href=http://www.google.com>[bar</a></u>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<sub><font size=2>[bar</font></sub>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font size=2><sub>[bar</sub></font>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<sub><font size=3>[bar</font></sub>baz]\" compare innerHTML":true,
-  "[[\"inserttext\",\"a\"]] \"foo<font size=3><sub>[bar</sub></font>baz]\" compare innerHTML":true,
   "[[\"insertunorderedlist\",\"\"]] \"foo<br>[bar]\" compare innerHTML":true,
   "[[\"insertunorderedlist\",\"\"]] \"[foo<ol><li>bar]</ol>baz\" queryCommandIndeterm(\"insertunorderedlist\") before":true,
   "[[\"insertunorderedlist\",\"\"]] \"foo<ol><li>[bar</ol>baz]\" queryCommandIndeterm(\"insertunorderedlist\") before":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"insertunorderedlist\",\"\"]] \"<p>foo<p>[bar]<p>baz\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"insertunorderedlist\",\"\"]] \"<p>foo<p>[bar]<p>baz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
   "[[\"defaultparagraphseparator\",\"div\"],[\"insertunorderedlist\",\"\"]] \"<p>foo<p>[bar]<p>baz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"insertunorderedlist\",\"\"]] \"<p>foo<p>[bar]<p>baz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
   "[[\"defaultparagraphseparator\",\"p\"],[\"insertunorderedlist\",\"\"]] \"<p>foo<p>[bar]<p>baz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
@@ -11213,20 +11150,16 @@
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"foo<u style=\\\"text-decoration: line-through\\\">[bar]</u>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"strikethrough\",\"\"]] \"foo<u style=\\\"text-decoration: line-through\\\">b[a]r</u>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"foo<u style=\\\"text-decoration: line-through\\\">b[a]r</u>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"foo<u style=\\\"text-decoration: line-through\\\">b[a]r</u>baz\" queryCommandState(\"strikethrough\") after":true,
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"foo<s style=\\\"text-decoration: overline\\\">[bar]</s>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"foo<s style=\\\"text-decoration: overline\\\">b[a]r</s>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"foo<u style=\\\"text-decoration: overline\\\">[bar]</u>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"foo<u style=\\\"text-decoration: overline\\\">b[a]r</u>baz\" compare innerHTML":true,
-  "[[\"stylewithcss\",\"true\"],[\"strikethrough\",\"\"]] \"<p style=\\\"text-decoration: line-through\\\">foo[bar]baz</p>\" compare innerHTML":true,
-  "[[\"stylewithcss\",\"true\"],[\"strikethrough\",\"\"]] \"<p style=\\\"text-decoration: line-through\\\">foo[bar]baz</p>\" queryCommandState(\"strikethrough\") after":true,
-  "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"<p style=\\\"text-decoration: line-through\\\">foo[bar]baz</p>\" compare innerHTML":true,
-  "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"<p style=\\\"text-decoration: line-through\\\">foo[bar]baz</p>\" queryCommandState(\"strikethrough\") after":true,
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"<p style=\\\"text-decoration: overline\\\">foo[bar]baz</p>\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"foo<span class=\\\"underline\\\">[bar]</span>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"foo<span class=\\\"underline\\\">b[a]r</span>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"strikethrough\",\"\"]] \"fo[o<s>bar</s>b]az\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"strikethrough\",\"\"]] \"foo[<s>b]ar</s>baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"strikethrough\",\"\"]] \"foo<s>ba[r</s>]baz\" compare innerHTML":true,
   "[[\"stylewithcss\",\"true\"],[\"strikethrough\",\"\"]] \"<strike>fo[o</strike><s>b]ar</s>\" compare innerHTML":true,
   "[[\"stylewithcss\",\"false\"],[\"strikethrough\",\"\"]] \"<strike>fo[o</strike><s>b]ar</s>\" compare innerHTML":true,
--- a/editor/libeditor/html/nsHTMLEditRules.cpp
+++ b/editor/libeditor/html/nsHTMLEditRules.cpp
@@ -1266,19 +1266,20 @@ nsHTMLEditRules::WillInsertText(EditActi
   
   // initialize out param
   *aCancel = false;
   *aHandled = true;
   nsresult res;
   nsCOMPtr<nsIDOMNode> selNode;
   int32_t selOffset;
 
-  // if the selection isn't collapsed, delete it.
+  // If the selection isn't collapsed, delete it.  Don't delete existing inline
+  // tags, because we're hopefully going to insert text (bug 787432).
   if (!aSelection->Collapsed()) {
-    res = mHTMLEditor->DeleteSelection(nsIEditor::eNone, nsIEditor::eStrip);
+    res = mHTMLEditor->DeleteSelection(nsIEditor::eNone, nsIEditor::eNoStrip);
     NS_ENSURE_SUCCESS(res, res);
   }
 
   res = WillInsert(aSelection, aCancel);
   NS_ENSURE_SUCCESS(res, res);
   // initialize out param
   // we want to ignore result of WillInsert()
   *aCancel = false;
--- a/editor/libeditor/html/tests/Makefile.in
+++ b/editor/libeditor/html/tests/Makefile.in
@@ -75,16 +75,17 @@ MOCHITEST_FILES = \
 		test_keypress_untrusted_event.html \
 		test_select_all_without_body.html \
 		file_select_all_without_body.html \
 		test_root_element_replacement.html \
 		test_bug738366.html \
 		test_bug757371.html \
 		test_bug767684.html \
 		test_bug780035.html \
+		test_bug787432.html \
 		$(NULL)
 
 ifneq (mobile,$(MOZ_BUILD_APP))
 MOCHITEST_FILES +=  test_spellcheck_pref.html \
 		$(NULL)
 endif
 
 _DATA_FILES = \
new file mode 100644
--- /dev/null
+++ b/editor/libeditor/html/tests/test_bug787432.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=787432
+-->
+<title>Test for Bug 787432</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=787432">Mozilla Bug 787432</a>
+<div id="test" contenteditable><span class="insert">%</span><br></div>
+<script>
+var div = document.getElementById("test");
+getSelection().collapse(div.firstChild, 0);
+getSelection().extend(div.firstChild, 1);
+document.execCommand("inserttext", false, "x");
+is(div.innerHTML, '<span class="insert">x</span><br>',
+   "Empty <span> needs to not be removed");
+</script>