--- a/editcommands.html Mon Jun 20 15:21:57 2011 -0600
+++ b/editcommands.html Mon Jun 20 15:48:05 2011 -0600
@@ -5589,6 +5589,11 @@
<li>Abort these steps.
</ol>
+ <!-- If some text is inserted into <p><br></p> or similar, we no longer need
+ the <br>. -->
+ <li>If <var title="">node</var> has only one <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a>, which is a <a href=#collapsed-line-break>collapsed
+ line break</a>, remove its <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> from it.
+
<li>Let <var title="">text</var> be the result of calling <code class=external data-anolis-spec=domcore title=dom-Document-createTextNode><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createtextnode>createTextNode(<var title="">value</var>)</a></code> on
the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#context-object>context object</a>.
--- a/implementation.js Mon Jun 20 15:21:57 2011 -0600
+++ b/implementation.js Mon Jun 20 15:48:05 2011 -0600
@@ -5750,6 +5750,13 @@
return;
}
+ // "If node has only one child, which is a collapsed line break, remove
+ // its child from it."
+ if (node.childNodes.length == 1
+ && isCollapsedLineBreak(node.firstChild)) {
+ node.removeChild(node.firstChild);
+ }
+
// "Let text be the result of calling createTextNode(value) on the
// context object."
var text = document.createTextNode(value);
--- a/source.html Mon Jun 20 15:21:57 2011 -0600
+++ b/source.html Mon Jun 20 15:48:05 2011 -0600
@@ -5608,6 +5608,11 @@
<li>Abort these steps.
</ol>
+ <!-- If some text is inserted into <p><br></p> or similar, we no longer need
+ the <br>. -->
+ <li>If <var>node</var> has only one [[child]], which is a <span>collapsed
+ line break</span>, remove its [[child]] from it.
+
<li>Let <var>text</var> be the result of calling <code
data-anolis-spec=domcore
title=dom-Document-createTextNode>createTextNode(<var>value</var>)</code> on
--- a/tests.js Mon Jun 20 15:21:57 2011 -0600
+++ b/tests.js Mon Jun 20 15:48:05 2011 -0600
@@ -1841,6 +1841,9 @@
[' ', '<span style=white-space:pre-wrap>[]foo</span>'],
[' ', '<span style=white-space:pre-wrap>foo []bar</span>'],
+ [' ', '{}<br>'],
+ [' ', '<p>{}<br>'],
+
[' ', 'foo[]'],
'foo[]bar',
@@ -1861,6 +1864,7 @@
'<a href=/>foo</a>[]bar',
'<p>fo[o<p>b]ar',
'<p>fo[o<p>bar<p>b]az',
+ '{}<br>',
'<p>{}<br>',
'<p><span>{}<br></span>',
],