--- a/editcommands.html Fri May 13 13:35:21 2011 -0600
+++ b/editcommands.html Fri May 13 14:04:14 2011 -0600
@@ -27,7 +27,7 @@
<body class=draft>
<div class=head id=head>
<h1>HTML Editing Commands</h1>
-<h2 class="no-num no-toc" id=work-in-progress-—-last-update-12-may-2011>Work in Progress — Last Update 12 May 2011</h2>
+<h2 class="no-num no-toc" id=work-in-progress-—-last-update-13-may-2011>Work in Progress — Last Update 13 May 2011</h2>
<dl>
<dt>Editor
<dd>Aryeh Gregor <ayg+spec@aryeh.name>
@@ -2407,21 +2407,8 @@
on <var title="">img</var>.
<!-- No alt text, so it's invalid. This matches all browsers. -->
- <li>If <var title="">node</var> is a <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node, and <var title="">offset</var> is not
- equal to 0 or the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-node-length title=concept-node-length>length</a> of <var title="">node</var>, run <code class=external data-anolis-spec=domcore title=dom-Text-splitText><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-text-splittext>splitText(<var title="">offset</var>)</a></code> on
- <var title="">node</var>.
-
- <li>If <var title="">node</var> is a <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> node, and <var title="">offset</var> is equal to
- the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-node-length title=concept-node-length>length</a> of <var title="">node</var>, set <var title="">node</var> to its
- <code class=external data-anolis-spec=domcore title=dom-Node-nextSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-nextsibling>nextSibling</a></code>.
-
- <li>If <var title="">node</var> is null or is a <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text>Text</a></code> or <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#comment>Comment</a></code> node, run
- <code class=external data-anolis-spec=domcore title=dom-Node-insertBefore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-insertbefore>insertBefore(<var title="">img</var>,
- <var title="">node</var>)</a></code> on the parent of <var title="">node</var>.
-
- <li>Otherwise, let <var title="">child</var> be the <var title="">offset</var>th child of
- <var title="">node</var> (or null if there is no such child), and run <code class=external data-anolis-spec=domcore title=dom-Node-insertBefore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-insertbefore>insertBefore(<var title="">img</var>,
- <var title="">child</var>)</a></code> on <var title="">node</var>.
+ <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 the
+ <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range title=concept-range>range</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 the <code class=external data-anolis-spec=domrange><a href=http://html5.org/specs/dom-range.html#selection>Selection</a></code>, 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
--- a/implementation.js Fri May 13 13:35:21 2011 -0600
+++ b/implementation.js Fri May 13 14:04:14 2011 -0600
@@ -2532,35 +2532,8 @@
// "Run setAttribute("src", value) on img."
img.setAttribute("src", value);
- // "If node is a Text node, and offset is not equal to 0 or the length
- // of node, run splitText(offset) on node."
- if (node.nodeType == Node.TEXT_NODE
- && offset != 0
- && offset != node.length) {
- node.splitText(offset);
- }
-
- // "If node is a Text node, and offset is equal to the length of node,
- // set node to its nextSibling."
- if (node.nodeType == Node.TEXT_NODE
- && offset == node.length) {
- node = node.nextSibling;
- }
-
- // "If node is null or is a Text or Comment node, run insertBefore(img,
- // node) on the parent of node."
- if (!node
- || node.nodeType == Node.TEXT_NODE
- || node.nodeType == Node.COMMENT_NODE) {
- node.parentNode.insertBefore(img, node);
- // "Otherwise, let child be the offsetth child of node (or null if
- // there is no such child), and run insertBefore(img, child) on node."
- } else {
- var child = node.childNodes.length == offset
- ? null
- : node.childNodes[offset];
- node.insertBefore(img, child);
- }
+ // "Run insertNode(img) on the range."
+ range.insertNode(img);
// "Run collapse() on the Selection, with first argument equal to the
// parent of img and the second argument equal to one plus the index of
--- a/source.html Fri May 13 13:35:21 2011 -0600
+++ b/source.html Fri May 13 14:04:14 2011 -0600
@@ -2449,26 +2449,9 @@
on <var>img</var>.
<!-- No alt text, so it's invalid. This matches all browsers. -->
- <li>If <var>node</var> is a [[text]] node, and <var>offset</var> is not
- equal to 0 or the [[nodelength]] of <var>node</var>, run <code
- data-anolis-spec=domcore
- title=dom-Text-splitText>splitText(<var>offset</var>)</code> on
- <var>node</var>.
-
- <li>If <var>node</var> is a [[text]] node, and <var>offset</var> is equal to
- the [[nodelength]] of <var>node</var>, set <var>node</var> to its
- [[nextsibling]].
-
- <li>If <var>node</var> is null or is a [[text]] or [[comment]] node, run
- <code data-anolis-spec=domcore
- title=dom-Node-insertBefore>insertBefore(<var>img</var>,
- <var>node</var>)</code> on the parent of <var>node</var>.
-
- <li>Otherwise, let <var>child</var> be the <var>offset</var>th child of
- <var>node</var> (or null if there is no such child), and run <code
- data-anolis-spec=domcore
- title=dom-Node-insertBefore>insertBefore(<var>img</var>,
- <var>child</var>)</code> on <var>node</var>.
+ <li>Run <code data-anolis-spec=domrange
+ title=dom-Range-insertNode>insertNode(<var>img</var>)</code> on the
+ [[range]].
<li>Run <code data-anolis-spec=domrange
title=dom-Selection-collapse>collapse()</code> on the [[selection]], with