--- a/editcommands.html Tue Jul 05 11:18:10 2011 -0600
+++ b/editcommands.html Tue Jul 05 11:31:29 2011 -0600
@@ -1208,12 +1208,11 @@
<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>, it 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 the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range title=concept-range>range</a>'s <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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 not 0; or it has at least 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>, and all 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>children</a> are <a href=#effectively-contained>effectively contained</a> in the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range title=concept-range>range</a>.
-<!-- Logically, the effectively contained nodes are supposed to be the ones
-returned by decomposing the range, or their descendants. We can't actually
-define it that way, because decomposing the range has side effects (calling
-splitText()), and anyway text nodes might not be returned by decomposing even
-if they're effectively contained: it might be that the new node created by
-splitText() is returned. -->
+<!-- The difference between "contained" and "effectively contained" is
+basically that 1) in <b>[foo]</b>, the <b> is effectively contained but not
+contained; and 2) in <b>f[o]o</b>, the text node is effectively contained but
+not contained. This is used mostly for the "decompose" algorithm, and also for
+most inline commands' states. -->
<p>A <dfn id=modifiable-element>modifiable element</dfn> is a <code class=external data-anolis-spec=html title="the b element"><a href=http://www.whatwg.org/html/#the-b-element>b</a></code>, <code class=external data-anolis-spec=html title="the em element"><a href=http://www.whatwg.org/html/#the-em-element>em</a></code>, <code class=external data-anolis-spec=html title="the i element"><a href=http://www.whatwg.org/html/#the-i-element>i</a></code>, <code class=external data-anolis-spec=html title="the s element"><a href=http://www.whatwg.org/html/#the-s-element>s</a></code>, <code class=external data-anolis-spec=html title="the span element"><a href=http://www.whatwg.org/html/#the-span-element>span</a></code>,
<code class=external data-anolis-spec=html title="the strike element"><a href=http://www.whatwg.org/html/#the-strike-element>strike</a></code>, <code class=external data-anolis-spec=html title="the strong element"><a href=http://www.whatwg.org/html/#the-strong-element>strong</a></code>, <code class=external data-anolis-spec=html title="the sub and sup elements"><a href=http://www.whatwg.org/html/#the-sub-and-sup-elements>sub</a></code>, <code class=external data-anolis-spec=html title="the sub and sup elements"><a href=http://www.whatwg.org/html/#the-sub-and-sup-elements>sup</a></code>, or <code class=external data-anolis-spec=html title="the u element"><a href=http://www.whatwg.org/html/#the-u-element>u</a></code> element with no attributes
@@ -1515,35 +1514,22 @@
<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> and <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</a> are the same,
return an empty list.
- <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 <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
- 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 neither 0 nor 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 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>, 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()</a></code> on 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>
- with argument equal to 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>.
-
- <li>If <var title="">range</var>'s <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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 <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
- its <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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 neither 0 nor 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 its
- <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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>, 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()</a></code> on its <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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>
- with argument equal to its <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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>.
-
- <!-- Now we want to make sure our range contains as many nodes as possible,
- such as by changing <tag>[foo]</tag> to {<tag>foo</tag>}. -->
- <li>Let <var title="">cloned range</var> be the result of calling <code class=external data-anolis-spec=domrange title=dom-Range-cloneRange><a href=http://html5.org/specs/dom-range.html#dom-range-clonerange>cloneRange()</a></code> on
- <var title="">range</var>.
-
- <li>While 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> <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> of <var title="">cloned range</var> is 0,
- and 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="">cloned 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
- not null, 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="">cloned range</var> to (<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
- <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>, <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> of <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>).
-
- <li>While the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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> of <var title="">cloned range</var> equals 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 its <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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>, and 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="">cloned range</var>'s <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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 not null, set the
- <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</a> of <var title="">cloned range</var> to (<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 <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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>, 1 + <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> of <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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>).
-
- <li>Return a list consisting of every <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node title=concept-node>node</a> <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#contained>contained</a> in <var title="">cloned
- range</var> in <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#tree-order>tree order</a>, omitting any whose <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> is also
- <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#contained>contained</a> in <var title="">cloned 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 an
+ <a href=#editable>editable</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 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
+ neither 0 nor 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 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>, 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()</a></code> on 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> with argument equal to 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>.
+
+ <li>If <var title="">range</var>'s <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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 an <a href=#editable>editable</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 its <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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 neither 0 nor 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 its <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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>, 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()</a></code> on its
+ <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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> with argument equal to its <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</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>.
+
+ <!-- We want to make sure the returned list contains as many nodes as
+ possible, such as by treating <tag>[foo]</tag> as {<tag>foo</tag>}. -->
+ <li>Return a list consisting of every <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node title=concept-node>node</a> <a href=#effectively-contained>effectively
+ contained</a> in <var title="">range</var>, omitting any whose <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> is also
+ <a href=#effectively-contained>effectively contained</a> in <var title="">range</var>.
</ol>
--- a/implementation.js Tue Jul 05 11:18:10 2011 -0600
+++ b/implementation.js Tue Jul 05 11:31:29 2011 -0600
@@ -1452,7 +1452,31 @@
return false;
}
-// Like getAllContainedNodes(), but for effectively contained nodes.
+// Like get(All)ContainedNodes(), but for effectively contained nodes.
+function getEffectivelyContainedNodes(range, condition) {
+ if (typeof condition == "undefined") {
+ condition = function() { return true };
+ }
+ var node = range.startContainer;
+ while (isEffectivelyContained(node.parentNode, range)) {
+ node = node.parentNode;
+ }
+
+ var stop = nextNodeDescendants(range.endContainer);
+
+ var nodeList = [];
+ while (isBefore(node, stop)) {
+ if (isEffectivelyContained(node, range)
+ && condition(node)) {
+ nodeList.push(node);
+ node = nextNodeDescendants(node);
+ continue;
+ }
+ node = nextNode(node);
+ }
+ return nodeList;
+}
+
function getAllEffectivelyContainedNodes(range, condition) {
if (typeof condition == "undefined") {
condition = function() { return true };
@@ -1997,10 +2021,11 @@
return [];
}
- // "If range's start node is a Text node and its start offset is neither 0
- // nor the length of its start node, run splitText() on its start node with
- // argument equal to its start offset."
- if (range.startContainer.nodeType == Node.TEXT_NODE
+ // "If range's start node is an editable Text node and its start offset is
+ // neither 0 nor the length of its start node, run splitText() on its start
+ // node with argument equal to its start offset."
+ if (isEditable(range.startContainer)
+ && range.startContainer.nodeType == Node.TEXT_NODE
&& range.startOffset != 0
&& range.startOffset != getNodeLength(range.startContainer)) {
// Account for UAs not following range mutation rules
@@ -2015,10 +2040,11 @@
}
}
- // "If range's end node is a Text node and its end offset is neither 0 nor
- // the length of its end node, run splitText() on its end node with
- // argument equal to its end offset."
- if (range.endContainer.nodeType == Node.TEXT_NODE
+ // "If range's end node is an editable Text node and its end offset is
+ // neither 0 nor the length of its end node, run splitText() on its end
+ // node with argument equal to its end offset."
+ if (isEditable(range.endContainer)
+ && range.endContainer.nodeType == Node.TEXT_NODE
&& range.endOffset != 0
&& range.endOffset != getNodeLength(range.endContainer)) {
// IE seems to mutate the range incorrectly here, so we need correction
@@ -2030,36 +2056,9 @@
range.setEnd(newEnd[0], newEnd[1]);
}
- // "Let cloned range be the result of calling cloneRange() on range."
- var clonedRange = range.cloneRange();
-
- // "While the start offset of cloned range is 0, and the parent of cloned
- // range's start node is not null, set the start of cloned range to (parent
- // of start node, index of start node)."
- while (clonedRange.startOffset == 0
- && clonedRange.startContainer.parentNode) {
- clonedRange.setStart(clonedRange.startContainer.parentNode, getNodeIndex(clonedRange.startContainer));
- }
-
- // "While the end offset of cloned range equals the length of its end node,
- // and the parent of clone range's end node is not null, set the end of
- // cloned range to (parent of end node, 1 + index of end node)."
- while (clonedRange.endOffset == getNodeLength(clonedRange.endContainer)
- && clonedRange.endContainer.parentNode) {
- clonedRange.setEnd(clonedRange.endContainer.parentNode, 1 + getNodeIndex(clonedRange.endContainer));
- }
-
- // "Return a list consisting of every Node contained in cloned range in
- // tree order, omitting any whose parent is also contained in cloned
- // range."
- var ret = [];
- for (var node = clonedRange.startContainer; node != nextNodeDescendants(clonedRange.endContainer); node = nextNode(node)) {
- if (isContained(node, clonedRange)
- && !isContained(node.parentNode, clonedRange)) {
- ret.push(node);
- }
- }
- return ret;
+ // "Return a list consisting of every node effectively contained in range,
+ // omitting any whose parent is also effectively contained in range."
+ return getEffectivelyContainedNodes(range);
}
//@}
--- a/source.html Tue Jul 05 11:18:10 2011 -0600
+++ b/source.html Tue Jul 05 11:31:29 2011 -0600
@@ -1164,12 +1164,11 @@
[[bpnode]], it is a [[text]] node, and the [[range]]'s [[rangeend]]
[[bpoffset]] is not 0; or it has at least one [[child]], and all its
[[children]] are <span>effectively contained</span> in the [[range]].
-<!-- Logically, the effectively contained nodes are supposed to be the ones
-returned by decomposing the range, or their descendants. We can't actually
-define it that way, because decomposing the range has side effects (calling
-splitText()), and anyway text nodes might not be returned by decomposing even
-if they're effectively contained: it might be that the new node created by
-splitText() is returned. -->
+<!-- The difference between "contained" and "effectively contained" is
+basically that 1) in <b>[foo]</b>, the <b> is effectively contained but not
+contained; and 2) in <b>f[o]o</b>, the text node is effectively contained but
+not contained. This is used mostly for the "decompose" algorithm, and also for
+most inline commands' states. -->
<p>A <dfn>modifiable element</dfn> is a [[b]], [[em]], [[i]], [[s]], [[span]],
[[strike]], [[strong]], [[sub]], [[sup]], or [[u]] element with no attributes
@@ -1472,38 +1471,24 @@
<li>If <var>range</var>'s [[rangestart]] and [[rangeend]] are the same,
return an empty list.
- <li>If <var>range</var>'s [[rangestart]] [[bpnode]] is a [[text]] node and
- its [[rangestart]] [[bpoffset]] is neither 0 nor the [[nodelength]] of its
- [[rangestart]] [[bpnode]], run <code data-anolis-spec=domcore
- title=dom-Text-splitText>splitText()</code> on its [[rangestart]] [[bpnode]]
- with argument equal to its [[rangestart]] [[bpoffset]].
-
- <li>If <var>range</var>'s [[rangeend]] [[bpnode]] is a [[text]] node and
- its [[rangeend]] [[bpoffset]] is neither 0 nor the [[nodelength]] of its
- [[rangeend]] [[bpnode]], run <code data-anolis-spec=domcore
- title=dom-Text-splitText>splitText()</code> on its [[rangeend]] [[bpnode]]
- with argument equal to its [[rangeend]] [[bpoffset]].
-
- <!-- Now we want to make sure our range contains as many nodes as possible,
- such as by changing <tag>[foo]</tag> to {<tag>foo</tag>}. -->
- <li>Let <var>cloned range</var> be the result of calling <code
- data-anolis-spec=domrange title=dom-Range-cloneRange>cloneRange()</code> on
- <var>range</var>.
-
- <li>While the [[rangestart]] [[bpoffset]] of <var>cloned range</var> is 0,
- and the [[parent]] of <var>cloned range</var>'s [[rangestart]] [[bpnode]] is
- not null, set the [[rangestart]] of <var>cloned range</var> to ([[parent]] of
- [[rangestart]] [[bpnode]], [[index]] of [[rangestart]] [[bpnode]]).
-
- <li>While the [[rangeend]] [[bpoffset]] of <var>cloned range</var> equals the
- [[nodelength]] of its [[rangeend]] [[bpnode]], and the [[parent]] of
- <var>cloned range</var>'s [[rangeend]] [[bpnode]] is not null, set the
- [[rangeend]] of <var>cloned range</var> to ([[parent]] of [[rangeend]]
- [[bpnode]], 1 + [[index]] of [[rangeend]] [[bpnode]]).
-
- <li>Return a list consisting of every [[node]] [[contained]] in <var>cloned
- range</var> in [[treeorder]], omitting any whose [[parent]] is also
- [[contained]] in <var>cloned range</var>.
+ <li>If <var>range</var>'s [[rangestart]] [[bpnode]] is an
+ <span>editable</span> [[text]] node and its [[rangestart]] [[bpoffset]] is
+ neither 0 nor the [[nodelength]] of its [[rangestart]] [[bpnode]], run <code
+ data-anolis-spec=domcore title=dom-Text-splitText>splitText()</code> on its
+ [[rangestart]] [[bpnode]] with argument equal to its [[rangestart]]
+ [[bpoffset]].
+
+ <li>If <var>range</var>'s [[rangeend]] [[bpnode]] is an <span>editable</span>
+ [[text]] node and its [[rangeend]] [[bpoffset]] is neither 0 nor the
+ [[nodelength]] of its [[rangeend]] [[bpnode]], run <code
+ data-anolis-spec=domcore title=dom-Text-splitText>splitText()</code> on its
+ [[rangeend]] [[bpnode]] with argument equal to its [[rangeend]] [[bpoffset]].
+
+ <!-- We want to make sure the returned list contains as many nodes as
+ possible, such as by treating <tag>[foo]</tag> as {<tag>foo</tag>}. -->
+ <li>Return a list consisting of every [[node]] <span>effectively
+ contained</span> in <var>range</var>, omitting any whose [[parent]] is also
+ <span>effectively contained</span> in <var>range</var>.
</ol>
<!-- @} -->