--- a/editcommands.html Tue Jul 12 15:27:50 2011 -0600
+++ b/editcommands.html Tue Jul 12 15:31:51 2011 -0600
@@ -6572,20 +6572,18 @@
<li>Call <code class=external data-anolis-spec=domcore title=dom-Node-appendChild><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-appendchild>appendChild(<var title="">frag</var>)</a></code> on <var title="">new container</var>.
- <li>If <var title="">container</var> has no <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>children</a>, call <code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("br")</a></code>
- on the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#context-object>context object</a>, and append the result as the last <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of
- <var title="">container</var>.
-
- <li>If <var title="">new container</var> has no <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>children</a>, call
+ <li>If <var title="">container</var> has no <a href=#visible>visible</a> <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>children</a>, call
<code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("br")</a></code> on the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#context-object>context object</a>, and append the result as the
- last <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">new container</var>.
+ last <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">container</var>.
+
+ <li>If <var title="">new container</var> has no <a href=#visible>visible</a> <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>children</a>,
+ call <code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("br")</a></code> on the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#context-object>context object</a>, and append the result
+ as the last <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">new container</var>.
<!-- These two steps follow Firefox 5.0a2, Chrome 13 dev, and Opera 11.10.
IE9 instead inserts an which magically does not appear in innerHTML.
In all cases, the reason is that an empty block box in CSS will have zero
height, so the user won't be able to put the selection cursor inside it. -->
- <p class=XXX>Needs to also happen if there are only comments/whitespace/etc.
-
<li>Set the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-start title=concept-range-start>start</a> of <var title="">range</var> to (<var title="">new container</var>,
0).
</ol>
--- a/implementation.js Tue Jul 12 15:27:50 2011 -0600
+++ b/implementation.js Tue Jul 12 15:31:51 2011 -0600
@@ -6781,17 +6781,17 @@
// "Call appendChild(frag) on new container."
newContainer.appendChild(frag);
- // "If container has no children, call createElement("br") on the
- // context object, and append the result as the last child of
+ // "If container has no visible children, call createElement("br") on
+ // the context object, and append the result as the last child of
// container."
- if (!container.hasChildNodes()) {
+ if (![].some.call(container.childNodes, isVisible)) {
container.appendChild(document.createElement("br"));
}
- // "If new container has no children, call createElement("br") on the
- // context object, and append the result as the last child of new
- // container."
- if (!newContainer.hasChildNodes()) {
+ // "If new container has no visible children, call createElement("br")
+ // on the context object, and append the result as the last child of
+ // new container."
+ if (![].some.call(newContainer.childNodes, isVisible)) {
newContainer.appendChild(document.createElement("br"));
}
--- a/source.html Tue Jul 12 15:27:50 2011 -0600
+++ b/source.html Tue Jul 12 15:31:51 2011 -0600
@@ -6569,20 +6569,18 @@
<li>Call [[appendchild|<var>frag</var>]] on <var>new container</var>.
- <li>If <var>container</var> has no [[children]], call [[createelement|"br"]]
- on the [[contextobject]], and append the result as the last [[child]] of
- <var>container</var>.
-
- <li>If <var>new container</var> has no [[children]], call
+ <li>If <var>container</var> has no <span>visible</span> [[children]], call
[[createelement|"br"]] on the [[contextobject]], and append the result as the
- last [[child]] of <var>new container</var>.
+ last [[child]] of <var>container</var>.
+
+ <li>If <var>new container</var> has no <span>visible</span> [[children]],
+ call [[createelement|"br"]] on the [[contextobject]], and append the result
+ as the last [[child]] of <var>new container</var>.
<!-- These two steps follow Firefox 5.0a2, Chrome 13 dev, and Opera 11.10.
IE9 instead inserts an which magically does not appear in innerHTML.
In all cases, the reason is that an empty block box in CSS will have zero
height, so the user won't be able to put the selection cursor inside it. -->
- <p class=XXX>Needs to also happen if there are only comments/whitespace/etc.
-
<li>Set the [[rangestart]] of <var>range</var> to (<var>new container</var>,
0).
</ol>
--- a/tests.js Tue Jul 12 15:27:50 2011 -0600
+++ b/tests.js Tue Jul 12 15:31:51 2011 -0600
@@ -2073,6 +2073,9 @@
'<a href=foo>foo[]bar</a>baz',
'<a href=foo>foo[]</a>bar',
'foo<a href=foo>[]bar</a>',
+
+ '<p>foo[]<!--bar-->',
+ '<p><!--foo-->[]bar',
],
//@}
inserttext: [