--- a/editcommands.html Wed Jun 15 13:05:46 2011 -0600
+++ b/editcommands.html Wed Jun 15 13:33:45 2011 -0600
@@ -2820,22 +2820,31 @@
<li><a href=#delete-the-contents>Delete the contents</a> of <var title="">range</var>.
- <li>Let <var title="">img</var> be the result of calling <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("img")</a></code> on the
- <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#context-object>context object</a>.
-
- <li>Run <code class=external data-anolis-spec=domcore title=dom-Element-setAttribute><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-element-setattribute>setAttribute("src", <var title="">value</var>)</a></code>
- on <var title="">img</var>.
- <!-- No alt text, so it's invalid. This matches all browsers. -->
-
- <li>Run <code class=external data-anolis-spec=domrange title=dom-Range-insertNode><a href=http://html5.org/specs/dom-range.html#dom-range-insertnode>insertNode(<var title="">img</var>)</a></code> on
- <var title="">range</var>.
+ <li>If <var title="">range</var>'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> is a <a href=#prohibited-paragraph-child>prohibited paragraph
+ child</a> whose sole <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> is a <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>, and its <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-offset title=concept-boundary-point-offset>offset</a> is 0,
+ remove its <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 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.
+ <!-- Same logic as with insertHTML. -->
+
+ <li>Let <var title="">img</var> be the result of calling <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("img")</a></code> on
+ the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#context-object>context object</a>.
+
+ <li>Run <code class=external data-anolis-spec=domcore title=dom-Element-setAttribute><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-element-setattribute>setAttribute("src", <var title="">value</var>)</a></code> on <var title="">img</var>.
+ <!-- No alt text, so it's probably invalid. This matches all browsers. -->
+
+ <li>Run <code class=external data-anolis-spec=domrange title=dom-Range-insertNode><a href=http://html5.org/specs/dom-range.html#dom-range-insertnode>insertNode(<var title="">img</var>)</a></code> on <var title="">range</var>.
+ <!--
+ This winds up putting it at the original start point of the active range, as
+ currently specced. This matches IE9 and Firefox 5.0a2. Chrome 13 dev puts
+ it at the end point, and Opera 11.11 puts it in between (where the range
+ would collapse if you called deleteContents()).
+ -->
<li>Let <var title="">selection</var> be the result of calling <code class=external data-anolis-spec=domrange title=dom-Document-getSelection><a href=http://html5.org/specs/dom-range.html#dom-document-getselection>getSelection()</a></code> on the
<a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#context-object>context object</a>.
- <li>Run <code class=external data-anolis-spec=domrange title=dom-Selection-collapse><a href=http://html5.org/specs/dom-range.html#dom-selection-collapse>collapse()</a></code> on <var title="">selection</var>, with
- first argument equal to the <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a> of <var title="">img</var> and the second
- argument equal to one plus the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> of <var title="">img</var>.
+ <li>Run <code class=external data-anolis-spec=domrange title=dom-Selection-collapse><a href=http://html5.org/specs/dom-range.html#dom-selection-collapse>collapse()</a></code> on <var title="">selection</var>, with first argument equal
+ to the <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a> of <var title="">img</var> and the second argument equal to one plus
+ the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> of <var title="">img</var>.
</ol>
--- a/implementation.js Wed Jun 15 13:05:46 2011 -0600
+++ b/implementation.js Wed Jun 15 13:33:45 2011 -0600
@@ -3290,6 +3290,16 @@
// "Delete the contents of range."
deleteContents(range);
+ // "If range's start node is a prohibited paragraph child whose sole
+ // child is a br, and its start offset is 0, remove its start node's
+ // child from it."
+ if (isProhibitedParagraphChild(range.startContainer)
+ && range.startContainer.childNodes.length == 1
+ && isHtmlElement(range.startContainer.firstChild, "br")
+ && range.startOffset == 0) {
+ range.startContainer.removeChild(range.startContainer.firstChild);
+ }
+
// "Let img be the result of calling createElement("img") on the
// context object."
var img = document.createElement("img");
--- a/preprocess Wed Jun 15 13:05:46 2011 -0600
+++ b/preprocess Wed Jun 15 13:33:45 2011 -0600
@@ -117,6 +117,7 @@
'extend': '<code data-anolis-spec=domrange title=dom-Selection-extend>extend(\\1)</code>',
'insertnode': '<code data-anolis-spec=domrange title=dom-Range-insertNode>insertNode(\\1)</code>',
'selcollapse': '<code data-anolis-spec=domrange title=dom-Selection-collapse>collapse(\\1)</code>',
+ 'setattribute': '<code data-anolis-spec=domcore title=dom-Element-setAttribute>setAttribute(\\1)</code>',
}
for key in fnreplace:
--- a/source.html Wed Jun 15 13:05:46 2011 -0600
+++ b/source.html Wed Jun 15 13:33:45 2011 -0600
@@ -2801,27 +2801,31 @@
<li><span>Delete the contents</span> of <var>range</var>.
- <li>Let <var>img</var> be the result of calling <code
- data-anolis-spec=domcore
- title=dom-Document-createElement>createElement("img")</code> on the
- [[contextobject]].
-
- <li>Run <code data-anolis-spec=domcore
- title=dom-Element-setAttribute>setAttribute("src", <var>value</var>)</code>
- on <var>img</var>.
- <!-- No alt text, so it's invalid. This matches all browsers. -->
-
- <li>Run <code data-anolis-spec=domrange
- title=dom-Range-insertNode>insertNode(<var>img</var>)</code> on
- <var>range</var>.
+ <li>If <var>range</var>'s [[startnode]] is a <span>prohibited paragraph
+ child</span> whose sole [[child]] is a [[br]], and its [[startoffset]] is 0,
+ remove its [[startnode]]'s [[child]] from it.
+ <!-- Same logic as with insertHTML. -->
+
+ <li>Let <var>img</var> be the result of calling [[createelement|"img"]] on
+ the [[contextobject]].
+
+ <li>Run [[setattribute|"src", <var>value</var>]] on <var>img</var>.
+ <!-- No alt text, so it's probably invalid. This matches all browsers. -->
+
+ <li>Run [[insertnode|<var>img</var>]] on <var>range</var>.
+ <!--
+ This winds up putting it at the original start point of the active range, as
+ currently specced. This matches IE9 and Firefox 5.0a2. Chrome 13 dev puts
+ it at the end point, and Opera 11.11 puts it in between (where the range
+ would collapse if you called deleteContents()).
+ -->
<li>Let <var>selection</var> be the result of calling [[getselection]] on the
[[contextobject]].
- <li>Run <code data-anolis-spec=domrange
- title=dom-Selection-collapse>collapse()</code> on <var>selection</var>, with
- first argument equal to the [[parent]] of <var>img</var> and the second
- argument equal to one plus the [[index]] of <var>img</var>.
+ <li>Run [[selcollapse|]] on <var>selection</var>, with first argument equal
+ to the [[parent]] of <var>img</var> and the second argument equal to one plus
+ the [[index]] of <var>img</var>.
</ol>
<!-- @} -->