--- a/editcommands.html Sun Jul 10 12:50:29 2011 -0600
+++ b/editcommands.html Sun Jul 10 12:55:22 2011 -0600
@@ -1046,6 +1046,29 @@
<h3 id=allowed-children><span class=secno>6.3 </span>Allowed children</h3>
+<p>A <dfn id=name-of-an-element-with-inline-contents>name of an element with inline contents</dfn> is "a", "abbr", "b",
+"bdi", "bdo", "cite", "code", "dfn", "em", "h1", "h2", "h3", "h4", "h5", "h6",
+"i", "kbd", "mark", "p", "pre", "q", "rp", "rt", "ruby", "s", "samp", "small",
+"span", "strong", "sub", "sup", "u", "var", "acronym", "listing", "strike",
+"xmp", "big", "blink", "font", "marquee", "nobr", or "tt".
+
+<p class=XXX>This deliberately omits "dt", because I don't like the fact that
+including it will cause various commands to break apart lists rather than put
+bad things inside dt.
+
+<p>An <dfn id=element-with-inline-contents>element with inline contents</dfn> is an <a href=#html-element>HTML element</a>
+whose <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> is a <a href=#name-of-an-element-with-inline-contents>name of an element with inline contents</a>.
+<!-- List is mostly based on current HTML5, together with obsolete elements. I
+mostly got the obsolete element list by testing what Firefox 5.0a2 splits when
+you do insertHorizontalRule. -->
+
+<p class=XXX>The definitions of prohibited paragraph children and elements with
+inline contents should be in the HTML spec (possibly under a different name) so
+they don't fall out of sync. They'll do for now. Also, I might want to rename
+"prohibited paragraph child" given how I'm using it; I have to decide whether I
+want to key off CSS (like "inline node" does) or HTML (like "prohibited
+paragraph child") when deciding what to treat as a block and what not.
+
<p>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> or string <var title="">child</var> is an <dfn id=allowed-child>allowed child</dfn> of 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> or string <var title="">parent</var> if the following algorithm returns true:
@@ -1098,10 +1121,10 @@
cases too, so no need for complication. -->
<li>If <var title="">child</var> is a <a href=#prohibited-paragraph-child-name>prohibited paragraph child name</a>
- and <var title="">parent</var> or some <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-ancestor title=concept-tree-ancestor>ancestor</a> of <var title="">parent</var> is a <code class=external data-anolis-spec=html title="the p element"><a href=http://www.whatwg.org/html/#the-p-element>p</a></code>
- or <a href=#element-with-inline-contents>element with inline contents</a>, return false.
- <!-- This generally cannot be serialized either, for p. For elements with
- inline contents, this serves to prevent things like
+ and <var title="">parent</var> or some <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-ancestor title=concept-tree-ancestor>ancestor</a> of <var title="">parent</var> is an
+ <a href=#element-with-inline-contents>element with inline contents</a>, return false.
+ <!-- This generally cannot be serialized either, for p. For other elements
+ with inline contents, this serves to prevent things like
<span><p>foo</p></span>, which will parse fine but aren't supposed to
happen anyway. -->
@@ -1159,7 +1182,7 @@
<tr><td>h1, h2, h3, h4, h5, h6 <td>h1, h2, h3, h4, h5, h6
<tr><td>li <td>li
<tr><td>nobr <td>nobr
- <tr><td>p, all <a href=#name-of-an-element-with-inline-contents title="name of an element with inline contents">names
+ <tr><td>all <a href=#name-of-an-element-with-inline-contents title="name of an element with inline contents">names
of an element with inline contents</a>
<td>All <a href=#prohibited-paragraph-child-name title="prohibited paragraph child name">prohibited
paragraph child names</a>
@@ -3014,29 +3037,6 @@
<h3 id=block-formatting-command-definitions><span class=secno>8.1 </span>Block formatting command definitions</h3>
-<p>A <dfn id=name-of-an-element-with-inline-contents>name of an element with inline contents</dfn> is "a", "abbr", "b",
-"bdi", "bdo", "cite", "code", "dfn", "em", "h1", "h2", "h3", "h4", "h5", "h6",
-"i", "kbd", "mark", "pre", "q", "rp", "rt", "ruby", "s", "samp", "small",
-"span", "strong", "sub", "sup", "u", "var", "acronym", "listing", "strike",
-"xmp", "big", "blink", "font", "marquee", "nobr", or "tt".
-
-<p class=XXX>This deliberately omits "dt", because I don't like the fact that
-including it will cause various commands to break apart lists rather than put
-bad things inside dt.
-
-<p>An <dfn id=element-with-inline-contents>element with inline contents</dfn> is an <a href=#html-element>HTML element</a>
-whose <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> is a <a href=#name-of-an-element-with-inline-contents>name of an element with inline contents</a>.
-<!-- List is mostly based on current HTML5, together with obsolete elements. I
-mostly got the obsolete element list by testing what Firefox 5.0a2 splits when
-you do insertHorizontalRule. -->
-
-<p class=XXX>The definitions of prohibited paragraph children and elements with
-inline contents should be in the HTML spec (possibly under a different name) so
-they don't fall out of sync. They'll do for now. Also, I might want to rename
-"prohibited paragraph child" given how I'm using it; I have to decide whether I
-want to key off CSS (like "inline node" does) or HTML (like "prohibited
-paragraph child") when deciding what to treat as a block and what not.
-
<p>A <dfn id=potential-indentation-element>potential indentation element</dfn> is either a <code class=external data-anolis-spec=html title="the blockquote element"><a href=http://www.whatwg.org/html/#the-blockquote-element>blockquote</a></code>, or a
<code class=external data-anolis-spec=html title="the div element"><a href=http://www.whatwg.org/html/#the-div-element>div</a></code> that has a <code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code> attribute that sets "margin" or some subproperty
of it.
--- a/implementation.js Sun Jul 10 12:50:29 2011 -0600
+++ b/implementation.js Sun Jul 10 12:55:22 2011 -0600
@@ -1277,6 +1277,23 @@
///// Allowed children /////
//@{
+// "A name of an element with inline contents is "a", "abbr", "b", "bdi",
+// "bdo", "cite", "code", "dfn", "em", "h1", "h2", "h3", "h4", "h5", "h6", "i",
+// "kbd", "mark", "p", "pre", "q", "rp", "rt", "ruby", "s", "samp", "small",
+// "span", "strong", "sub", "sup", "u", "var", "acronym", "listing", "strike",
+// "xmp", "big", "blink", "font", "marquee", "nobr", or "tt"."
+var namesOfElementsWithInlineContents = ["a", "abbr", "b", "bdi", "bdo",
+ "cite", "code", "dfn", "em", "h1", "h2", "h3", "h4", "h5", "h6", "i",
+ "kbd", "mark", "p", "pre", "q", "rp", "rt", "ruby", "s", "samp", "small",
+ "span", "strong", "sub", "sup", "u", "var", "acronym", "listing", "strike",
+ "xmp", "big", "blink", "font", "marquee", "nobr", "tt"];
+
+// "An element with inline contents is an HTML element whose local name is a
+// name of an element with inline contents."
+function isElementWithInlineContents(node) {
+ return isHtmlElement(node, namesOfElementsWithInlineContents);
+}
+
function isAllowedChild(child, parent_) {
// "If parent is "colgroup", "table", "tbody", "tfoot", "thead", "tr", or
// an HTML element with local name equal to one of those, and child is a
@@ -1324,7 +1341,7 @@
// return false."
//
// "If child is a prohibited paragraph child name and parent or some
- // ancestor of parent is a p or element with inline contents, return
+ // ancestor of parent is an element with inline contents, return
// false."
//
// "If child is "h1", "h2", "h3", "h4", "h5", or "h6", and parent or
@@ -1336,8 +1353,7 @@
return false;
}
if (prohibitedParagraphChildNames.indexOf(child) != -1
- && (isHtmlElement(ancestor, "p")
- || isElementWithInlineContents(ancestor))) {
+ && isElementWithInlineContents(ancestor)) {
return false;
}
if (/^h[1-6]$/.test(child)
@@ -1416,7 +1432,7 @@
[["h1", "h2", "h3", "h4", "h5", "h6"], ["h1", "h2", "h3", "h4", "h5", "h6"]],
[["li"], ["li"]],
[["nobr"], ["nobr"]],
- [["p"].concat(namesOfElementsWithInlineContents), prohibitedParagraphChildNames],
+ [namesOfElementsWithInlineContents, prohibitedParagraphChildNames],
[["td", "th"], ["caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"]],
];
for (var i = 0; i < table.length; i++) {
@@ -3339,23 +3355,6 @@
///// Block formatting command definitions /////
//@{
-// "A name of an element with inline contents is "a", "abbr", "b", "bdi",
-// "bdo", "cite", "code", "dfn", "em", "h1", "h2", "h3", "h4", "h5", "h6", "i",
-// "kbd", "mark", "pre", "q", "rp", "rt", "ruby", "s", "samp", "small", "span",
-// "strong", "sub", "sup", "u", "var", "acronym", "listing", "strike", "xmp",
-// "big", "blink", "font", "marquee", "nobr", or "tt"."
-var namesOfElementsWithInlineContents = ["a", "abbr", "b", "bdi", "bdo",
- "cite", "code", "dfn", "em", "h1", "h2", "h3", "h4", "h5", "h6", "i",
- "kbd", "mark", "pre", "q", "rp", "rt", "ruby", "s", "samp", "small",
- "span", "strong", "sub", "sup", "u", "var", "acronym", "listing", "strike",
- "xmp", "big", "blink", "font", "marquee", "nobr", "tt"];
-
-// "An element with inline contents is an HTML element whose local name is a
-// name of an element with inline contents."
-function isElementWithInlineContents(node) {
- return isHtmlElement(node, namesOfElementsWithInlineContents);
-}
-
// "A potential indentation element is either a blockquote, or a div that has a
// style attribute that sets "margin" or some subproperty of it."
function isPotentialIndentationElement(node) {
--- a/source.html Sun Jul 10 12:50:29 2011 -0600
+++ b/source.html Sun Jul 10 12:55:22 2011 -0600
@@ -1000,6 +1000,29 @@
<h3>Allowed children</h3>
<!-- @{ -->
+<p>A <dfn>name of an element with inline contents</dfn> is "a", "abbr", "b",
+"bdi", "bdo", "cite", "code", "dfn", "em", "h1", "h2", "h3", "h4", "h5", "h6",
+"i", "kbd", "mark", "p", "pre", "q", "rp", "rt", "ruby", "s", "samp", "small",
+"span", "strong", "sub", "sup", "u", "var", "acronym", "listing", "strike",
+"xmp", "big", "blink", "font", "marquee", "nobr", or "tt".
+
+<p class=XXX>This deliberately omits "dt", because I don't like the fact that
+including it will cause various commands to break apart lists rather than put
+bad things inside dt.
+
+<p>An <dfn>element with inline contents</dfn> is an <span>HTML element</span>
+whose [[localname]] is a <span>name of an element with inline contents</span>.
+<!-- List is mostly based on current HTML5, together with obsolete elements. I
+mostly got the obsolete element list by testing what Firefox 5.0a2 splits when
+you do insertHorizontalRule. -->
+
+<p class=XXX>The definitions of prohibited paragraph children and elements with
+inline contents should be in the HTML spec (possibly under a different name) so
+they don't fall out of sync. They'll do for now. Also, I might want to rename
+"prohibited paragraph child" given how I'm using it; I have to decide whether I
+want to key off CSS (like "inline node" does) or HTML (like "prohibited
+paragraph child") when deciding what to treat as a block and what not.
+
<p>A [[node]] or string <var>child</var> is an <dfn>allowed child</dfn> of a
[[node]] or string <var>parent</var> if the following algorithm returns true:
@@ -1052,10 +1075,10 @@
cases too, so no need for complication. -->
<li>If <var>child</var> is a <span>prohibited paragraph child name</span>
- and <var>parent</var> or some [[ancestor]] of <var>parent</var> is a [[p]]
- or <span>element with inline contents</span>, return false.
- <!-- This generally cannot be serialized either, for p. For elements with
- inline contents, this serves to prevent things like
+ and <var>parent</var> or some [[ancestor]] of <var>parent</var> is an
+ <span>element with inline contents</span>, return false.
+ <!-- This generally cannot be serialized either, for p. For other elements
+ with inline contents, this serves to prevent things like
<span><p>foo</p></span>, which will parse fine but aren't supposed to
happen anyway. -->
@@ -1113,7 +1136,7 @@
<tr><td>h1, h2, h3, h4, h5, h6 <td>h1, h2, h3, h4, h5, h6
<tr><td>li <td>li
<tr><td>nobr <td>nobr
- <tr><td>p, all <span title="name of an element with inline contents">names
+ <tr><td>all <span title="name of an element with inline contents">names
of an element with inline contents</span>
<td>All <span title="prohibited paragraph child name">prohibited
paragraph child names</span>
@@ -2990,29 +3013,6 @@
<h3>Block formatting command definitions</h3>
<!-- @{ -->
-<p>A <dfn>name of an element with inline contents</dfn> is "a", "abbr", "b",
-"bdi", "bdo", "cite", "code", "dfn", "em", "h1", "h2", "h3", "h4", "h5", "h6",
-"i", "kbd", "mark", "pre", "q", "rp", "rt", "ruby", "s", "samp", "small",
-"span", "strong", "sub", "sup", "u", "var", "acronym", "listing", "strike",
-"xmp", "big", "blink", "font", "marquee", "nobr", or "tt".
-
-<p class=XXX>This deliberately omits "dt", because I don't like the fact that
-including it will cause various commands to break apart lists rather than put
-bad things inside dt.
-
-<p>An <dfn>element with inline contents</dfn> is an <span>HTML element</span>
-whose [[localname]] is a <span>name of an element with inline contents</span>.
-<!-- List is mostly based on current HTML5, together with obsolete elements. I
-mostly got the obsolete element list by testing what Firefox 5.0a2 splits when
-you do insertHorizontalRule. -->
-
-<p class=XXX>The definitions of prohibited paragraph children and elements with
-inline contents should be in the HTML spec (possibly under a different name) so
-they don't fall out of sync. They'll do for now. Also, I might want to rename
-"prohibited paragraph child" given how I'm using it; I have to decide whether I
-want to key off CSS (like "inline node" does) or HTML (like "prohibited
-paragraph child") when deciding what to treat as a block and what not.
-
<p>A <dfn>potential indentation element</dfn> is either a [[blockquote]], or a
[[div]] that has a [[style]] attribute that sets "margin" or some subproperty
of it.