--- a/autoimplementation.html Tue May 31 14:35:03 2011 -0600
+++ b/autoimplementation.html Tue May 31 14:53:34 2011 -0600
@@ -701,6 +701,8 @@
['<h1>', '<p>[foo</p>bar]'],
['<p>', '<div>[foo<p>bar]</p></div>'],
+ ['<p>', '<xmp>[foo]</xmp>'],
+ ['<div>', '<xmp>[foo]</xmp>'],
],
hilitecolor: [
'foo[]bar',
@@ -1555,6 +1557,9 @@
'<blockquote><ol><li>[foo]</ol></blockquote><p>extra',
'<blockquote>foo<ol><li>[bar]</ol>baz</blockquote><p>extra',
'<blockquote><ol><li>foo</li><ol><li>[bar]</ol><li>baz</ol></blockquote><p>extra',
+
+ '<ol><li><h1>[foo]</h1></ol>',
+ '<ol><li><xmp>[foo]</xmp></li></ol>',
],
removeformat: [
'foo[]bar',
--- a/editcommands.html Tue May 31 14:35:03 2011 -0600
+++ b/editcommands.html Tue May 31 14:53:34 2011 -0600
@@ -2866,12 +2866,10 @@
<code class=external data-anolis-spec=html title="the dl element"><a href=http://www.whatwg.org/html/#the-dl-element>dl</a></code>:
<ol>
- <li><a href=#set-the-tag-name>Set the tag name</a> of <var title="">node</var> to "div", and let
- <var title="">node</var> be the result.
-
- <li><a href=#block-format>Block-format</a> the one-<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> list consisting of
- <var title="">node</var>, with <var title="">value</var> equal to the <a href=#default-single-line-container-name>default
- single-line container name</a>.
+ <li><a href=#set-the-tag-name>Set the tag name</a> of <var title="">node</var> to the <a href=#default-single-line-container-name>default
+ single-line container name</a>, and let <var title="">node</var> be the result.
+
+ <li><a href=#fix-prohibited-paragraph-descendants>Fix prohibited paragraph descendants</a> of <var title="">node</var>.
<li>Abort these steps.
</ol>
@@ -3175,11 +3173,13 @@
string <var title="">value</var>:
<ol>
- <li>For each <var title="">node</var> in <var title="">input nodes</var>, while <var title="">node</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 an <a href=#editable>editable</a> <a href=#html-element>HTML element</a>
- <a href=#in-the-same-editing-host>in the same editing host</a> with <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-local-name title=concept-element-local-name>local name</a> "address", "h1",
- "h2", "h3", "h4", "h5", "h6", "p", or "pre", <a href=#split-the-parent>split the parent</a> of
- the one-<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> list consisting of <var title="">node</var>.
+ <li>For each <var title="">node</var> in <var title="">input nodes</var>, while either
+ <var title="">node</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 an <a href=#editable>editable</a> <a href=#html-element>HTML
+ element</a> <a href=#in-the-same-editing-host>in the same editing host</a> with <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-local-name title=concept-element-local-name>local name</a>
+ "address", "h1", "h2", "h3", "h4", "h5", "h6", "p", or "pre"; or
+ <var title="">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 not null, and "p" is not an <a href=#allowed-child>allowed
+ child</a> of <var title="">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>: <a href=#split-the-parent>split the parent</a>
+ of the one-<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> list consisting of <var title="">node</var>.
<div class=XXX>
<p>This is needed so we don't get things like p nested inside address, and
--- a/implementation.js Tue May 31 14:35:03 2011 -0600
+++ b/implementation.js Tue May 31 14:53:34 2011 -0600
@@ -2046,14 +2046,21 @@
}
function blockFormat(inputNodes, value) {
- // "For each node in input nodes, while node is a descendant of an editable
- // HTML element in the same editing host with local name "address", "h1",
- // "h2", "h3", "h4", "h5", "h6", "p", or "pre", split the parent of the
- // one-node list consisting of node."
+ // "For each node in input nodes, while either node is a descendant of an
+ // editable HTML element in the same editing host with local name
+ // "address", "h1", "h2", "h3", "h4", "h5", "h6", "p", or "pre"; or node's
+ // parent is not null, and "p" is not an allowed child of node's parent:
+ // split the parent of the one-node list consisting of node."
for (var i = 0; i < inputNodes.length; i++) {
var node = inputNodes[i];
- do {
+ while (true) {
+ if (node.parentNode
+ && !isAllowedChild("p", node.parentNode)) {
+ splitParent([node]);
+ continue;
+ }
+
var ancestor = node.parentNode;
while (ancestor
&& !isHtmlElement(ancestor, ["ADDRESS", "H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE"])) {
@@ -2066,7 +2073,7 @@
} else {
break;
}
- } while (true);
+ }
}
// "Let node list be a list of nodes, initially empty."
@@ -3713,12 +3720,12 @@
&& !isHtmlElement(node.parentNode, ["ol", "ul"]))
|| (isHtmlElement(node, ["dt", "dd"])
&& !isHtmlElement(node.parentNode, "dl"))) {
- // "Set the tag name of node to "div", and let node be the result."
- node = setTagName(node, "div");
-
- // "Block-format the one-node list consisting of node, with value equal
- // to the default single-line container name."
- blockFormat([node], defaultSingleLineContainerName);
+ // "Set the tag name of node to the default single-line container name,
+ // and let node be the result."
+ node = setTagName(node, defaultSingleLineContainerName);
+
+ // "Fix prohibited paragraph descendants of node."
+ fixProhibitedParagraphDescendants(node);
// "Abort these steps."
return;
--- a/source.html Tue May 31 14:35:03 2011 -0600
+++ b/source.html Tue May 31 14:53:34 2011 -0600
@@ -2868,12 +2868,10 @@
[[dl]]:
<ol>
- <li><span>Set the tag name</span> of <var>node</var> to "div", and let
- <var>node</var> be the result.
-
- <li><span>Block-format</span> the one-[[node]] list consisting of
- <var>node</var>, with <var>value</var> equal to the <span>default
- single-line container name</span>.
+ <li><span>Set the tag name</span> of <var>node</var> to the <span>default
+ single-line container name</span>, and let <var>node</var> be the result.
+
+ <li><span>Fix prohibited paragraph descendants</span> of <var>node</var>.
<li>Abort these steps.
</ol>
@@ -3183,11 +3181,13 @@
string <var>value</var>:
<ol>
- <li>For each <var>node</var> in <var>input nodes</var>, while <var>node</var>
- is a [[descendant]] of an <span>editable</span> <span>HTML element</span>
- <span>in the same editing host</span> with [[localname]] "address", "h1",
- "h2", "h3", "h4", "h5", "h6", "p", or "pre", <span>split the parent</span> of
- the one-[[node]] list consisting of <var>node</var>.
+ <li>For each <var>node</var> in <var>input nodes</var>, while either
+ <var>node</var> is a [[descendant]] of an <span>editable</span> <span>HTML
+ element</span> <span>in the same editing host</span> with [[localname]]
+ "address", "h1", "h2", "h3", "h4", "h5", "h6", "p", or "pre"; or
+ <var>node</var>'s [[parent]] is not null, and "p" is not an <span>allowed
+ child</span> of <var>node</var>'s [[parent]]: <span>split the parent</span>
+ of the one-[[node]] list consisting of <var>node</var>.
<div class=XXX>
<p>This is needed so we don't get things like p nested inside address, and