--- a/editcommands.html Sun Jul 10 12:08:36 2011 -0600
+++ b/editcommands.html Sun Jul 10 12:47:09 2011 -0600
@@ -654,8 +654,12 @@
I think. Plus table stuff, since that can't be a descendant of a p either,
although it won't auto-close it. -->
-<p>An <dfn id=inline-node>inline node</dfn> is either 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, or an <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> whose
-"display" property computes to "inline", "inline-block", or "inline-table".
+<p>A <dfn id=block-node>block node</dfn> is either an <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> whose "display" property
+does not have <a href=http://www.w3.org/TR/CSS21/cascade.html#computed-value>computed value</a> "inline" or "inline-block" or "inline-table" or
+"none", or a <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#document>Document</a></code>, or a <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#documentfragment>DocumentFragment</a></code>.
+
+<p>An <dfn id=inline-node>inline node</dfn> is a <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> that is not a <a href=#block-node>block
+node</a>.
<p class=XXX>We might not want this to key off CSS; perhaps we should be
listing elements instead? Needs testing.
@@ -3382,10 +3386,8 @@
<h3 id=deleting-the-contents-of-a-range><span class=secno>8.4 </span>Deleting the contents of a range</h3>
<p>To <dfn id=delete-the-contents>delete the contents</dfn> of a <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range title=concept-range>range</a> <var title="">range</var>:
-
-<p class=XXX>I'm uncertain about the use of prohibited paragraph children here.
-I'm using it mostly because it's convenient and seems relatively sensible. If
-we really want to use it, we probably want to change its name.
+<!-- TODO V2: Consider what should happen for block merging in corner cases
+like display: inline-table. -->
<ol>
<li>If <var title="">range</var> is null, abort these steps and do nothing.
@@ -3410,12 +3412,12 @@
-->
<ol>
- <li>If <var title="">start offset</var> is <var title="">start node</var>'s
- <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-node-length title=concept-node-length>length</a>, and <var title="">start node</var>'s <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 <a href=#in-the-same-editing-host>in the same
- editing host</a>, and <var title="">start node</var> is not a <a href=#prohibited-paragraph-child>prohibited
- paragraph child</a>, set <var title="">start offset</var> 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="">start node</var>, then set <var title="">start node</var> to its
- <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> and continue this loop from the beginning.
+ <li>If <var title="">start offset</var> is <var title="">start node</var>'s <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-node-length title=concept-node-length>length</a>, and
+ <var title="">start node</var>'s <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 <a href=#in-the-same-editing-host>in the same editing
+ host</a>, and <var title="">start node</var> is an <a href=#inline-node>inline node</a>, set
+ <var title="">start offset</var> 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="">start node</var>,
+ then set <var title="">start node</var> to its <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> and continue this loop
+ from the beginning.
<!--
For instance:
@@ -3425,8 +3427,8 @@
Then the next step will make it <b>foo</b><i>[bar]</i>.
- We don't want to do this for prohibited paragraph children, because that
- would lead to something like
+ We don't want to do this for block nodes, because that would lead to
+ something like
<p>foo[</p><p>]bar<p>
@@ -3443,14 +3445,13 @@
<li>Let <var title="">reference node</var> be the <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="">start node</var>
with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> equal to <var title="">start offset</var>.
- <li>If <var title="">reference node</var> is a <a href=#prohibited-paragraph-child>prohibited paragraph
- child</a> or an <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> with 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>, or is neither an
- <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> nor 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, break from this loop.
+ <li>If <var title="">reference node</var> is a <a href=#block-node>block node</a> or an
+ <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> with 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>, or is neither an <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> nor 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, break from this loop.
<!--
Don't descend into an element with no children, since then it won't get
- deleted even if it's selected. Don't descend into a prohibited paragraph
- child, because then we might wind up not mergings blocks when we should,
- e.g.
+ deleted even if it's selected. Don't descend into a block node, because
+ then we might wind up not mergings blocks when we should, e.g.
foo{<p>}bar</p>
-> foo<p>{}bar</p>
@@ -3467,18 +3468,18 @@
<ol>
<li>If <var title="">end offset</var> is 0, and <var title="">end node</var>'s
<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 <a href=#in-the-same-editing-host>in the same editing host</a>, and <var title="">end
- node</var> is not a <a href=#prohibited-paragraph-child>prohibited paragraph child</a>, set <var title="">end
- offset</var> to 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="">end node</var>, then set <var title="">end
- node</var> to its <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> and continue this loop from the beginning.
+ node</var> is an <a href=#inline-node>inline node</a>, set <var title="">end offset</var> to 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="">end node</var>, then set <var title="">end node</var> to its
+ <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> and continue this loop from the beginning.
<li>If <var title="">end offset</var> is 0, break from this loop.
<li>Let <var title="">reference node</var> be the <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="">end node</var>
with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> equal to <var title="">end offset</var> minus one.
- <li>If <var title="">reference node</var> is a <a href=#prohibited-paragraph-child>prohibited paragraph
- child</a> or an <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> with 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>, or is neither an
- <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> nor 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, break from this loop.
+ <li>If <var title="">reference node</var> is a <a href=#block-node>block node</a> or an
+ <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> with 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>, or is neither an <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> nor 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, break from this loop.
<li>Set <var title="">end node</var> to <var title="">reference node</var> and <var title="">end
offset</var> 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="">reference node</var>.
@@ -3514,19 +3515,21 @@
<var title="">range</var>.
<li>While <var title="">start block</var>'s <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 <a href=#in-the-same-editing-host>in the same editing
- host</a> and <var title="">start block</var> is not a <a href=#prohibited-paragraph-child>prohibited paragraph
- child</a>, set <var title="">start block</var> to its <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>.
-
- <li>If <var title="">start block</var> is neither a <a href=#prohibited-paragraph-child>prohibited paragraph
- child</a> nor an <a href=#editing-host>editing host</a>, or "span" is not an
- <a href=#allowed-child>allowed child</a> of <var title="">start block</var>, or <var title="">start
- block</var> is a <code class=external data-anolis-spec=html title="the td element"><a href=http://www.whatwg.org/html/#the-td-element>td</a></code> or <code class=external data-anolis-spec=html title="the th element"><a href=http://www.whatwg.org/html/#the-th-element>th</a></code>, set <var title="">start block</var> to null.
+ host</a> and <var title="">start block</var> is an <a href=#inline-node>inline node</a>, set
+ <var title="">start block</var> to its <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>.
+
+ <li>If <var title="">start block</var> is neither a <a href=#block-node>block node</a> nor an
+ <a href=#editing-host>editing host</a>, or "span" is not an <a href=#allowed-child>allowed child</a> of
+ <var title="">start block</var>, or <var title="">start block</var> is a <code class=external data-anolis-spec=html title="the td element"><a href=http://www.whatwg.org/html/#the-td-element>td</a></code> or <code class=external data-anolis-spec=html title="the th element"><a href=http://www.whatwg.org/html/#the-th-element>th</a></code>, set
+ <var title="">start block</var> to null.
<!--
- We only merge to or from prohibited paragraph children or editing hosts.
- (This is just in case someone makes a span into an editing host and sticks
- paragraphs inside it or something . . . we could probably drop that proviso.)
- Anything else is presumed to be an inline element, basically. This might not
- be ideal.
+ We only merge to or from block nodes or editing hosts. (This is just in case
+ someone makes a span into an editing host and sticks paragraphs inside it or
+ something . . . we could probably drop that proviso.) Firefox 7.0a2 ignores
+ the display property when merging, so it doesn't merge <span
+ style=display:block> but does merge <p style=display:inline>. This is
+ undesirable, because it's visually wrong. IE10PP2 and Chrome 14 dev behave
+ more like the spec, and Opera 11.50 seems to be unable to make up its mind.
If span isn't an allowed child, it's probably something unpleasant like a
table row or a list or such. We don't want to merge to or from something
@@ -3547,13 +3550,13 @@
<var title="">range</var>.
<li>While <var title="">end block</var>'s <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 <a href=#in-the-same-editing-host>in the same editing
- host</a> and <var title="">end block</var> is not a <a href=#prohibited-paragraph-child>prohibited paragraph
- child</a>, set <var title="">end block</var> to its <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>.
-
- <li>If <var title="">end block</var> is neither a <a href=#prohibited-paragraph-child>prohibited paragraph
- child</a> nor an <a href=#editing-host>editing host</a>, or "span" is not an
- <a href=#allowed-child>allowed child</a> of <var title="">end block</var>, or <var title="">end block</var>
- is a <code class=external data-anolis-spec=html title="the td element"><a href=http://www.whatwg.org/html/#the-td-element>td</a></code> or <code class=external data-anolis-spec=html title="the th element"><a href=http://www.whatwg.org/html/#the-th-element>th</a></code>, set <var title="">end block</var> to null.
+ host</a> and <var title="">end block</var> is an <a href=#inline-node>inline node</a>, set
+ <var title="">end block</var> to its <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>.
+
+ <li>If <var title="">end block</var> is neither a <a href=#block-node>block node</a> nor an
+ <a href=#editing-host>editing host</a>, or "span" is not an <a href=#allowed-child>allowed child</a> of
+ <var title="">end block</var>, or <var title="">end block</var> is a <code class=external data-anolis-spec=html title="the td element"><a href=http://www.whatwg.org/html/#the-td-element>td</a></code> or <code class=external data-anolis-spec=html title="the th element"><a href=http://www.whatwg.org/html/#the-th-element>th</a></code>, set
+ <var title="">end block</var> to null.
<!-- This is based on deleteContents() in DOM Range. -->
<li>If <var title="">start node</var> and <var title="">end node</var> are the same, and
@@ -3716,7 +3719,7 @@
<li>Otherwise, if <var title="">start block</var> is a <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-descendant title=concept-tree-descendant>descendant</a> of <var title="">end
block</var>:
<!-- Pull in everything that comes after <var title>start block</var>, until we hit
- a br or prohibited paragraph child. -->
+ a br or block node. -->
<ol>
<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> 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> of <var title="">range</var> to
@@ -3732,9 +3735,9 @@
<var title="">start block</var>'s <code class=external data-anolis-spec=domcore title=dom-Node-lastChild><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-lastchild>lastChild</a></code> from it.
<li>While the <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> of <var title="">reference node</var> is neither null
- nor 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> nor a <a href=#prohibited-paragraph-child>prohibited paragraph child</a>, append the
- <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> of <var title="">reference node</var> 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="">start block</var>, <a href=#preserving-ranges>preserving ranges</a>.
+ nor 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> nor a <a href=#block-node>block node</a>, append the <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> of
+ <var title="">reference node</var> 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="">start block</var>,
+ <a href=#preserving-ranges>preserving ranges</a>.
<li>If the <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> of <var title="">reference node</var> 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>, remove
it from its <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>.
@@ -5074,15 +5077,15 @@
<a href=#invisible>invisible</a> <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>, remove that <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
<var title="">node</var>, then subtract one from <var title="">offset</var>.
- <li>Otherwise, if <var title="">offset</var> is zero and <var title="">node</var> is not a
- <a href=#prohibited-paragraph-child>prohibited paragraph child</a>, or if <var title="">node</var> is an
+ <li>Otherwise, if <var title="">offset</var> is zero and <var title="">node</var> is an
+ <a href=#inline-node>inline node</a>, or if <var title="">node</var> is an
<a href=#invisible>invisible</a> <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>, set <var title="">offset</var> to 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="">node</var>, then set <var title="">node</var> to its <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>.
<li>Otherwise, if <var title="">node</var> has 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>child</a> with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a>
- <var title="">offset</var> − 1 and that <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 not a <a href=#prohibited-paragraph-child>prohibited
- paragraph child</a> or 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> or an <code class=external data-anolis-spec=html title="the img element"><a href=http://www.whatwg.org/html/#the-img-element>img</a></code>, set <var title="">node</var> to
- that <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>, then set <var title="">offset</var> 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="">offset</var> − 1 and that <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 not a <a href=#block-node>block
+ node</a> or 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> or an <code class=external data-anolis-spec=html title="the img element"><a href=http://www.whatwg.org/html/#the-img-element>img</a></code>, set <var title="">node</var> to that
+ <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>, then set <var title="">offset</var> 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>.
<li>Otherwise, break from this loop.
@@ -5091,18 +5094,18 @@
<!--
At this point, node cannot be an invisible node. There are three cases:
- 1) offset is zero and node is a prohibited paragraph child. Then we'll
- usually merge with the previous block if one exists.
-
- 2) offset is not zero, node is not a prohibited paragraph child, and node
- does not have a child with index offset - 1. The only way this is possible
- is if node has a length greater than zero but no children, which implies it's
- a text or comment or PI. Comments and PIs are invisible nodes, so it must be
- a text node. We delete the previous character.
+ 1) offset is zero and node is a block node. Then we'll usually merge with
+ the previous block if one exists.
+
+ 2) offset is not zero, node is not a block node, and node does not have a
+ child with index offset - 1. The only way this is possible is if node has a
+ length greater than zero but no children, which implies it's a text or
+ comment or PI. Comments and PIs are invisible nodes, so it must be a text
+ node. We delete the previous character.
3) offset is not zero, and the child of node with index offset - 1 is a
- prohibited paragraph child or a br or an img. Then we'll usually merge the
- offsetth child of node with the last descendant of the offset - 1st.
+ block node or a br or an img. Then we'll usually merge the offsetth child of
+ node with the last descendant of the offset - 1st.
-->
<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 zero,
@@ -5112,8 +5115,7 @@
(<var title="">node</var>, <var title="">offset</var>) and abort these steps.
<!-- At the time of this writing, this should be impossible. -->
- <li>If <var title="">node</var> is not a <a href=#prohibited-paragraph-child>prohibited paragraph child</a>,
- abort these steps.
+ <li>If <var title="">node</var> is an <a href=#inline-node>inline node</a>, abort these steps.
<li>If <var title="">node</var> has 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>child</a> with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> <var title="">offset</var>
− 1 and that <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> or <code class=external data-anolis-spec=html title="the hr element"><a href=http://www.whatwg.org/html/#the-hr-element>hr</a></code> or <code class=external data-anolis-spec=html title="the img element"><a href=http://www.whatwg.org/html/#the-img-element>img</a></code>, call
@@ -5637,15 +5639,15 @@
prop</a>, add one to <var title="">offset</var>.
<li>Otherwise, if <var title="">offset</var> is 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> and <var title="">node</var> is not a <a href=#prohibited-paragraph-child>prohibited paragraph
- child</a>, or if <var title="">node</var> is <a href=#invisible>invisible</a>, set
- <var title="">offset</var> 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="">node</var>, then set
- <var title="">node</var> to its <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>.
+ <var title="">node</var> and <var title="">node</var> is an <a href=#inline-node>inline node</a>, or if
+ <var title="">node</var> is <a href=#invisible>invisible</a>, set <var title="">offset</var> 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="">node</var>, then set <var title="">node</var> to its
+ <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>.
<li>Otherwise, if <var title="">node</var> has 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>child</a> with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a>
- <var title="">offset</var> and that <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 not a <a href=#prohibited-paragraph-child>prohibited paragraph
- child</a> or 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> or an <code class=external data-anolis-spec=html title="the img element"><a href=http://www.whatwg.org/html/#the-img-element>img</a></code>, set <var title="">node</var> to that
- <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>, then set <var title="">offset</var> to zero.
+ <var title="">offset</var> and that <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 not a <a href=#block-node>block node</a> or 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> or an <code class=external data-anolis-spec=html title="the img element"><a href=http://www.whatwg.org/html/#the-img-element>img</a></code>, set <var title="">node</var> to that <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>, then set
+ <var title="">offset</var> to zero.
<li>Otherwise, break from this loop.
</ol>
@@ -5661,8 +5663,7 @@
diacritic on the next letter being added to the previous one when the letter
is deleted. Worse, it places the cursor between a letter and its diacritic.
- <li>If <var title="">node</var> is not a <a href=#prohibited-paragraph-child>prohibited paragraph child</a>,
- abort these steps.
+ <li>If <var title="">node</var> is an <a href=#inline-node>inline node</a>, abort these steps.
<li>If <var title="">node</var> has 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>child</a> with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> <var title="">offset</var> and
that <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> or <code class=external data-anolis-spec=html title="the hr element"><a href=http://www.whatwg.org/html/#the-hr-element>hr</a></code> or <code class=external data-anolis-spec=html title="the img element"><a href=http://www.whatwg.org/html/#the-img-element>img</a></code>, call
--- a/implementation.js Sun Jul 10 12:08:36 2011 -0600
+++ b/implementation.js Sun Jul 10 12:47:09 2011 -0600
@@ -720,13 +720,19 @@
return isHtmlElement(node, prohibitedParagraphChildNames);
}
-// "An inline node is either a Text node, or an Element whose "display"
-// property computes to "inline", "inline-block", or "inline-table"."
+// "A block node is either an Element whose "display" property does not have
+// computed value "inline" or "inline-block" or "inline-table" or "none", or a
+// Document, or a DocumentFragment."
+function isBlockNode(node) {
+ return node
+ && ((node.nodeType == Node.ELEMENT_NODE && ["inline", "inline-block", "inline-table", "none"].indexOf(getComputedStyle(node).display) == -1)
+ || node.nodeType == Node.DOCUMENT_NODE
+ || node.nodeType == Node.DOCUMENT_FRAGMENT_NODE);
+}
+
+// "An inline node is a node that is not a block node."
function isInlineNode(node) {
- return node
- && (node.nodeType == Node.TEXT_NODE
- || (node.nodeType == Node.ELEMENT_NODE
- && ["inline", "inline-block", "inline-table"].indexOf(getComputedStyle(node).display) != -1));
+ return node && !isBlockNode(node);
}
// "An editing host is a node that is either an Element with a contenteditable
@@ -3870,13 +3876,12 @@
// "While start node has at least one child:"
while (startNode.hasChildNodes()) {
// "If start offset is start node's length, and start node's parent is
- // in the same editing host, and start node is not a prohibited
- // paragraph child, set start offset to one plus the index of start
- // node, then set start node to its parent and continue this loop from
- // the beginning."
+ // in the same editing host, and start node is an inline node, set
+ // start offset to one plus the index of start node, then set start
+ // node to its parent and continue this loop from the beginning."
if (startOffset == getNodeLength(startNode)
&& inSameEditingHost(startNode, startNode.parentNode)
- && !isProhibitedParagraphChild(startNode)) {
+ && isInlineNode(startNode)) {
startOffset = 1 + getNodeIndex(startNode);
startNode = startNode.parentNode;
continue;
@@ -3891,10 +3896,9 @@
// start offset."
var referenceNode = startNode.childNodes[startOffset];
- // "If reference node is a prohibited paragraph child or an Element
- // with no children, or is neither an Element nor a Text node, break
- // from this loop."
- if (isProhibitedParagraphChild(referenceNode)
+ // "If reference node is a block node or an Element with no children,
+ // or is neither an Element nor a Text node, break from this loop."
+ if (isBlockNode(referenceNode)
|| (referenceNode.nodeType == Node.ELEMENT_NODE
&& !referenceNode.hasChildNodes())
|| (referenceNode.nodeType != Node.ELEMENT_NODE
@@ -3910,12 +3914,12 @@
// "While end node has at least one child:"
while (endNode.hasChildNodes()) {
// "If end offset is 0, and end node's parent is in the same editing
- // host, and end node is not a prohibited paragraph child, set end
- // offset to the index of end node, then set end node to its parent and
- // continue this loop from the beginning."
+ // host, and end node is an inline node, set end offset to the index of
+ // end node, then set end node to its parent and continue this loop
+ // from the beginning."
if (endOffset == 0
&& inSameEditingHost(endNode, endNode.parentNode)
- && !isProhibitedParagraphChild(endNode)) {
+ && isInlineNode(endNode)) {
endOffset = getNodeIndex(endNode);
endNode = endNode.parentNode;
continue;
@@ -3930,10 +3934,9 @@
// offset minus one."
var referenceNode = endNode.childNodes[endOffset - 1];
- // "If reference node is a prohibited paragraph child or an Element
- // with no children, or is neither an Element nor a Text node, break
- // from this loop."
- if (isProhibitedParagraphChild(referenceNode)
+ // "If reference node is a block node or an Element with no children,
+ // or is neither an Element nor a Text node, break from this loop."
+ if (isBlockNode(referenceNode)
|| (referenceNode.nodeType == Node.ELEMENT_NODE
&& !referenceNode.hasChildNodes())
|| (referenceNode.nodeType != Node.ELEMENT_NODE
@@ -3983,16 +3986,16 @@
var startBlock = range.startContainer;
// "While start block's parent is in the same editing host and start block
- // is not a prohibited paragraph child, set start block to its parent."
+ // is an inline node, set start block to its parent."
while (inSameEditingHost(startBlock, startBlock.parentNode)
- && !isProhibitedParagraphChild(startBlock)) {
+ && isInlineNode(startBlock)) {
startBlock = startBlock.parentNode;
}
- // "If start block is neither a prohibited paragraph child nor an editing
- // host, or "span" is not an allowed child of start block, or start block
- // is a td or th, set start block to null."
- if ((!isProhibitedParagraphChild(startBlock) && !isEditingHost(startBlock))
+ // "If start block is neither a block node nor an editing host, or "span"
+ // is not an allowed child of start block, or start block is a td or th,
+ // set start block to null."
+ if ((!isBlockNode(startBlock) && !isEditingHost(startBlock))
|| !isAllowedChild("span", startBlock)
|| isHtmlElement(startBlock, ["td", "th"])) {
startBlock = null;
@@ -4002,16 +4005,16 @@
var endBlock = range.endContainer;
// "While end block's parent is in the same editing host and end block is
- // not a prohibited paragraph child, set end block to its parent."
+ // an inline node, set end block to its parent."
while (inSameEditingHost(endBlock, endBlock.parentNode)
- && !isProhibitedParagraphChild(endBlock)) {
+ && isInlineNode(endBlock)) {
endBlock = endBlock.parentNode;
}
- // "If end block is neither a prohibited paragraph child nor an editing
- // host, or "span" is not an allowed child of end block, or end block is a
- // td or th, set end block to null."
- if ((!isProhibitedParagraphChild(endBlock) && !isEditingHost(endBlock))
+ // "If end block is neither a block node nor an editing host, or "span" is
+ // not an allowed child of end block, or end block is a td or th, set end
+ // block to null."
+ if ((!isBlockNode(endBlock) && !isEditingHost(endBlock))
|| !isAllowedChild("span", endBlock)
|| isHtmlElement(endBlock, ["td", "th"])) {
endBlock = null;
@@ -4232,11 +4235,11 @@
}
// "While the nextSibling of reference node is neither null nor a br
- // nor a prohibited paragraph child, append the nextSibling of
- // reference node as the last child of start block, preserving ranges."
+ // nor a block node, append the nextSibling of reference node as the
+ // last child of start block, preserving ranges."
while (referenceNode.nextSibling
&& !isHtmlElement(referenceNode.nextSibling, "br")
- && !isProhibitedParagraphChild(referenceNode.nextSibling)) {
+ && !isBlockNode(referenceNode.nextSibling)) {
movePreservingRanges(referenceNode.nextSibling, startBlock, -1);
}
@@ -5266,21 +5269,21 @@
node.removeChild(node.childNodes[offset - 1]);
offset--;
- // "Otherwise, if offset is zero and node is not a prohibited
- // paragraph child, or if node is invisible, set offset to the
- // index of node, then set node to its parent."
+ // "Otherwise, if offset is zero and node is an inline node, or if
+ // node is an invisible node, set offset to the index of node, then
+ // set node to its parent."
} else if ((offset == 0
- && !isProhibitedParagraphChild(node))
+ && isInlineNode(node))
|| isInvisible(node)) {
offset = getNodeIndex(node);
node = node.parentNode;
// "Otherwise, if node has a child with index offset − 1 and that
- // child is not a prohibited paragraph child or a br or an img, set
- // node to that child, then set offset to the length of node."
+ // child is not a block node or a br or an img, set node to that
+ // child, then set offset to the length of node."
} else if (0 <= offset - 1
&& offset - 1 < node.childNodes.length
- && !isProhibitedParagraphChild(node.childNodes[offset - 1])
+ && !isBlockNode(node.childNodes[offset - 1])
&& !isHtmlElement(node.childNodes[offset - 1], ["br", "img"])) {
node = node.childNodes[offset - 1];
offset = getNodeLength(node);
@@ -5303,8 +5306,8 @@
return;
}
- // "If node is not a prohibited paragraph child, abort these steps."
- if (!isProhibitedParagraphChild(node)) {
+ // "If node is an inline node, abort these steps."
+ if (isInlineNode(node)) {
return;
}
@@ -5769,20 +5772,20 @@
&& isCollapsedBlockProp(node.childNodes[offset])) {
offset++;
- // "Otherwise, if offset is the length of node and node is not a
- // prohibited paragraph child, or if node is invisible, set offset
- // to one plus the index of node, then set node to its parent."
+ // "Otherwise, if offset is the length of node and node is an
+ // inline node, or if node is invisible, set offset to one plus the
+ // index of node, then set node to its parent."
} else if ((offset == getNodeLength(node)
- && !isProhibitedParagraphChild(node))
+ && isInlineNode(node))
|| isInvisible(node)) {
offset = 1 + getNodeIndex(node);
node = node.parentNode;
// "Otherwise, if node has a child with index offset and that child
- // is not a prohibited paragraph child or a br or an img, set node
- // to that child, then set offset to zero."
+ // is not a block node or a br or an img, set node to that child,
+ // then set offset to zero."
} else if (offset < node.childNodes.length
- && !isProhibitedParagraphChild(node.childNodes[offset])
+ && !isBlockNode(node.childNodes[offset])
&& !isHtmlElement(node.childNodes[offset], ["br", "img"])) {
node = node.childNodes[offset];
offset = 0;
@@ -5805,8 +5808,8 @@
return;
}
- // "If node is not a prohibited paragraph child, abort these steps."
- if (!isProhibitedParagraphChild(node)) {
+ // "If node is an inline node, abort these steps."
+ if (isInlineNode(node)) {
return;
}
--- a/source.html Sun Jul 10 12:08:36 2011 -0600
+++ b/source.html Sun Jul 10 12:47:09 2011 -0600
@@ -599,8 +599,12 @@
I think. Plus table stuff, since that can't be a descendant of a p either,
although it won't auto-close it. -->
-<p>An <dfn>inline node</dfn> is either a [[text]] node, or an [[element]] whose
-"display" property computes to "inline", "inline-block", or "inline-table".
+<p>A <dfn>block node</dfn> is either an [[element]] whose "display" property
+does not have [[compval]] "inline" or "inline-block" or "inline-table" or
+"none", or a [[document]], or a [[documentfragment]].
+
+<p>An <dfn>inline node</dfn> is a [[node]] that is not a <span>block
+node</span>.
<p class=XXX>We might not want this to key off CSS; perhaps we should be
listing elements instead? Needs testing.
@@ -3360,10 +3364,8 @@
<h3>Deleting the contents of a range</h3>
<!-- @{ -->
<p>To <dfn>delete the contents</dfn> of a [[range]] <var>range</var>:
-
-<p class=XXX>I'm uncertain about the use of prohibited paragraph children here.
-I'm using it mostly because it's convenient and seems relatively sensible. If
-we really want to use it, we probably want to change its name.
+<!-- TODO V2: Consider what should happen for block merging in corner cases
+like display: inline-table. -->
<ol>
<li>If <var>range</var> is null, abort these steps and do nothing.
@@ -3388,12 +3390,12 @@
-->
<ol>
- <li>If <var>start offset</var> is <var>start node</var>'s
- [[nodelength]], and <var>start node</var>'s [[parent]] is <span>in the same
- editing host</span>, and <var>start node</var> is not a <span>prohibited
- paragraph child</span>, set <var>start offset</var> to one plus the
- [[index]] of <var>start node</var>, then set <var>start node</var> to its
- [[parent]] and continue this loop from the beginning.
+ <li>If <var>start offset</var> is <var>start node</var>'s [[length]], and
+ <var>start node</var>'s [[parent]] is <span>in the same editing
+ host</span>, and <var>start node</var> is an <span>inline node</span>, set
+ <var>start offset</var> to one plus the [[index]] of <var>start node</var>,
+ then set <var>start node</var> to its [[parent]] and continue this loop
+ from the beginning.
<!--
For instance:
@@ -3403,8 +3405,8 @@
Then the next step will make it <b>foo</b><i>[bar]</i>.
- We don't want to do this for prohibited paragraph children, because that
- would lead to something like
+ We don't want to do this for block nodes, because that would lead to
+ something like
<p>foo[</p><p>]bar<p>
@@ -3421,14 +3423,13 @@
<li>Let <var>reference node</var> be the [[child]] of <var>start node</var>
with [[index]] equal to <var>start offset</var>.
- <li>If <var>reference node</var> is a <span>prohibited paragraph
- child</span> or an [[element]] with no [[children]], or is neither an
- [[element]] nor a [[text]] node, break from this loop.
+ <li>If <var>reference node</var> is a <span>block node</span> or an
+ [[element]] with no [[children]], or is neither an [[element]] nor a
+ [[text]] node, break from this loop.
<!--
Don't descend into an element with no children, since then it won't get
- deleted even if it's selected. Don't descend into a prohibited paragraph
- child, because then we might wind up not mergings blocks when we should,
- e.g.
+ deleted even if it's selected. Don't descend into a block node, because
+ then we might wind up not mergings blocks when we should, e.g.
foo{<p>}bar</p>
-> foo<p>{}bar</p>
@@ -3445,18 +3446,18 @@
<ol>
<li>If <var>end offset</var> is 0, and <var>end node</var>'s
[[parent]] is <span>in the same editing host</span>, and <var>end
- node</var> is not a <span>prohibited paragraph child</span>, set <var>end
- offset</var> to the [[index]] of <var>end node</var>, then set <var>end
- node</var> to its [[parent]] and continue this loop from the beginning.
+ node</var> is an <span>inline node</span>, set <var>end offset</var> to the
+ [[index]] of <var>end node</var>, then set <var>end node</var> to its
+ [[parent]] and continue this loop from the beginning.
<li>If <var>end offset</var> is 0, break from this loop.
<li>Let <var>reference node</var> be the [[child]] of <var>end node</var>
with [[index]] equal to <var>end offset</var> minus one.
- <li>If <var>reference node</var> is a <span>prohibited paragraph
- child</span> or an [[element]] with no [[children]], or is neither an
- [[element]] nor a [[text]] node, break from this loop.
+ <li>If <var>reference node</var> is a <span>block node</span> or an
+ [[element]] with no [[children]], or is neither an [[element]] nor a
+ [[text]] node, break from this loop.
<li>Set <var>end node</var> to <var>reference node</var> and <var>end
offset</var> to the [[nodelength]] of <var>reference node</var>.
@@ -3493,19 +3494,21 @@
<var>range</var>.
<li>While <var>start block</var>'s [[parent]] is <span>in the same editing
- host</span> and <var>start block</var> is not a <span>prohibited paragraph
- child</span>, set <var>start block</var> to its [[parent]].
-
- <li>If <var>start block</var> is neither a <span>prohibited paragraph
- child</span> nor an <span>editing host</span>, or "span" is not an
- <span>allowed child</span> of <var>start block</var>, or <var>start
- block</var> is a [[td]] or [[th]], set <var>start block</var> to null.
+ host</span> and <var>start block</var> is an <span>inline node</span>, set
+ <var>start block</var> to its [[parent]].
+
+ <li>If <var>start block</var> is neither a <span>block node</span> nor an
+ <span>editing host</span>, or "span" is not an <span>allowed child</span> of
+ <var>start block</var>, or <var>start block</var> is a [[td]] or [[th]], set
+ <var>start block</var> to null.
<!--
- We only merge to or from prohibited paragraph children or editing hosts.
- (This is just in case someone makes a span into an editing host and sticks
- paragraphs inside it or something . . . we could probably drop that proviso.)
- Anything else is presumed to be an inline element, basically. This might not
- be ideal.
+ We only merge to or from block nodes or editing hosts. (This is just in case
+ someone makes a span into an editing host and sticks paragraphs inside it or
+ something . . . we could probably drop that proviso.) Firefox 7.0a2 ignores
+ the display property when merging, so it doesn't merge <span
+ style=display:block> but does merge <p style=display:inline>. This is
+ undesirable, because it's visually wrong. IE10PP2 and Chrome 14 dev behave
+ more like the spec, and Opera 11.50 seems to be unable to make up its mind.
If span isn't an allowed child, it's probably something unpleasant like a
table row or a list or such. We don't want to merge to or from something
@@ -3526,13 +3529,13 @@
<var>range</var>.
<li>While <var>end block</var>'s [[parent]] is <span>in the same editing
- host</span> and <var>end block</var> is not a <span>prohibited paragraph
- child</span>, set <var>end block</var> to its [[parent]].
-
- <li>If <var>end block</var> is neither a <span>prohibited paragraph
- child</span> nor an <span>editing host</span>, or "span" is not an
- <span>allowed child</span> of <var>end block</var>, or <var>end block</var>
- is a [[td]] or [[th]], set <var>end block</var> to null.
+ host</span> and <var>end block</var> is an <span>inline node</span>, set
+ <var>end block</var> to its [[parent]].
+
+ <li>If <var>end block</var> is neither a <span>block node</span> nor an
+ <span>editing host</span>, or "span" is not an <span>allowed child</span> of
+ <var>end block</var>, or <var>end block</var> is a [[td]] or [[th]], set
+ <var>end block</var> to null.
<!-- This is based on deleteContents() in DOM Range. -->
<li>If <var>start node</var> and <var>end node</var> are the same, and
@@ -3695,7 +3698,7 @@
<li>Otherwise, if <var>start block</var> is a [[descendant]] of <var>end
block</var>:
<!-- Pull in everything that comes after <var>start block</var>, until we hit
- a br or prohibited paragraph child. -->
+ a br or block node. -->
<ol>
<li>Set the [[rangestart]] and [[rangeend]] of <var>range</var> to
@@ -3711,9 +3714,9 @@
<var>start block</var>'s [[lastchild]] from it.
<li>While the [[nextsibling]] of <var>reference node</var> is neither null
- nor a [[br]] nor a <span>prohibited paragraph child</span>, append the
- [[nextsibling]] of <var>reference node</var> as the last [[child]] of
- <var>start block</var>, <span>preserving ranges</span>.
+ nor a [[br]] nor a <span>block node</span>, append the [[nextsibling]] of
+ <var>reference node</var> as the last [[child]] of <var>start block</var>,
+ <span>preserving ranges</span>.
<li>If the [[nextsibling]] of <var>reference node</var> is a [[br]], remove
it from its [[parent]].
@@ -5075,15 +5078,15 @@
<span>invisible</span> [[node]], remove that [[child]] from
<var>node</var>, then subtract one from <var>offset</var>.
- <li>Otherwise, if <var>offset</var> is zero and <var>node</var> is not a
- <span>prohibited paragraph child</span>, or if <var>node</var> is an
+ <li>Otherwise, if <var>offset</var> is zero and <var>node</var> is an
+ <span>inline node</span>, or if <var>node</var> is an
<span>invisible</span> [[node]], set <var>offset</var> to the [[index]] of
<var>node</var>, then set <var>node</var> to its [[parent]].
<li>Otherwise, if <var>node</var> has a [[child]] with [[index]]
- <var>offset</var> − 1 and that [[child]] is not a <span>prohibited
- paragraph child</span> or a [[br]] or an [[img]], set <var>node</var> to
- that [[child]], then set <var>offset</var> to the [[nodelength]] of
+ <var>offset</var> − 1 and that [[child]] is not a <span>block
+ node</span> or a [[br]] or an [[img]], set <var>node</var> to that
+ [[child]], then set <var>offset</var> to the [[nodelength]] of
<var>node</var>.
<li>Otherwise, break from this loop.
@@ -5092,18 +5095,18 @@
<!--
At this point, node cannot be an invisible node. There are three cases:
- 1) offset is zero and node is a prohibited paragraph child. Then we'll
- usually merge with the previous block if one exists.
-
- 2) offset is not zero, node is not a prohibited paragraph child, and node
- does not have a child with index offset - 1. The only way this is possible
- is if node has a length greater than zero but no children, which implies it's
- a text or comment or PI. Comments and PIs are invisible nodes, so it must be
- a text node. We delete the previous character.
+ 1) offset is zero and node is a block node. Then we'll usually merge with
+ the previous block if one exists.
+
+ 2) offset is not zero, node is not a block node, and node does not have a
+ child with index offset - 1. The only way this is possible is if node has a
+ length greater than zero but no children, which implies it's a text or
+ comment or PI. Comments and PIs are invisible nodes, so it must be a text
+ node. We delete the previous character.
3) offset is not zero, and the child of node with index offset - 1 is a
- prohibited paragraph child or a br or an img. Then we'll usually merge the
- offsetth child of node with the last descendant of the offset - 1st.
+ block node or a br or an img. Then we'll usually merge the offsetth child of
+ node with the last descendant of the offset - 1st.
-->
<li>If <var>node</var> is a [[text]] node and <var>offset</var> is not zero,
@@ -5113,8 +5116,7 @@
(<var>node</var>, <var>offset</var>) and abort these steps.
<!-- At the time of this writing, this should be impossible. -->
- <li>If <var>node</var> is not a <span>prohibited paragraph child</span>,
- abort these steps.
+ <li>If <var>node</var> is an <span>inline node</span>, abort these steps.
<li>If <var>node</var> has a [[child]] with [[index]] <var>offset</var>
− 1 and that [[child]] is a [[br]] or [[hr]] or [[img]], call
@@ -5640,15 +5642,15 @@
prop</span>, add one to <var>offset</var>.
<li>Otherwise, if <var>offset</var> is the [[nodelength]] of
- <var>node</var> and <var>node</var> is not a <span>prohibited paragraph
- child</span>, or if <var>node</var> is <span>invisible</span>, set
- <var>offset</var> to one plus the [[index]] of <var>node</var>, then set
- <var>node</var> to its [[parent]].
+ <var>node</var> and <var>node</var> is an <span>inline node</span>, or if
+ <var>node</var> is <span>invisible</span>, set <var>offset</var> to one
+ plus the [[index]] of <var>node</var>, then set <var>node</var> to its
+ [[parent]].
<li>Otherwise, if <var>node</var> has a [[child]] with [[index]]
- <var>offset</var> and that [[child]] is not a <span>prohibited paragraph
- child</span> or a [[br]] or an [[img]], set <var>node</var> to that
- [[child]], then set <var>offset</var> to zero.
+ <var>offset</var> and that [[child]] is not a <span>block node</span> or a
+ [[br]] or an [[img]], set <var>node</var> to that [[child]], then set
+ <var>offset</var> to zero.
<li>Otherwise, break from this loop.
</ol>
@@ -5664,8 +5666,7 @@
diacritic on the next letter being added to the previous one when the letter
is deleted. Worse, it places the cursor between a letter and its diacritic.
- <li>If <var>node</var> is not a <span>prohibited paragraph child</span>,
- abort these steps.
+ <li>If <var>node</var> is an <span>inline node</span>, abort these steps.
<li>If <var>node</var> has a [[child]] with [[index]] <var>offset</var> and
that [[child]] is a [[br]] or [[hr]] or [[img]], call
--- a/tests.js Sun Jul 10 12:08:36 2011 -0600
+++ b/tests.js Sun Jul 10 12:47:09 2011 -0600
@@ -502,6 +502,14 @@
'<dl><dt>foo<dd>bar[<dd>]baz</dl>',
'<b>foo [ </b>bar]',
+
+ // Do we merge based on element names or the display property?
+ '<p style=display:inline>fo[o<p style=display:inline>b]ar',
+ '<span style=display:block>fo[o</span><span style=display:block>b]ar</span>',
+ '<span style=display:inline-block>fo[o</span><span style=display:inline-block>b]ar</span>',
+ '<span style=display:inline-table>fo[o</span><span style=display:inline-table>b]ar</span>',
+ '<span style=display:none>fo[o</span><span style=display:none>b]ar</span>',
+ '<quasit style=display:block>fo[o</quasit><quasit style=display:block>b]ar</quasit>',
],
//@}
fontname: [