--- a/editcommands.html Tue Jul 05 11:15:28 2011 -0600
+++ b/editcommands.html Tue Jul 05 11:18:10 2011 -0600
@@ -1611,25 +1611,8 @@
<!-- If we get past this step, we're something like <b class=foo> where we
want to keep the extra attributes, so we stick them on a span. -->
- <p class=XXX>Replace the following steps with "set the tag name".
-
- <li>Let <var title="">new element</var> be a new <a href=#html-element>HTML element</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> "span", with the same attributes and <code class=external data-anolis-spec=domcore title=dom-Node-ownerDocument><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-ownerdocument>ownerDocument</a></code> as
- <var title="">element</var>.
-
- <li>Insert <var title="">new element</var> into 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="">element</var>
- immediately before it.
- <!-- This means that the boundary point immediately before the element goes
- before the new element, and after we remove the old element, the boundary
- point immediately after the old element will be immediately after the new
- element, because of the regular range mutation rules. -->
-
- <li>While <var title="">element</var> has <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>, append its first <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> 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="">new element</var>, <a href=#preserving-ranges>preserving ranges</a>.
-
- <li>Remove <var title="">element</var> 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>.
-
- <li>Return 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="">new element</var>.
+ <li><a href=#set-the-tag-name>Set the tag name</a> of <var title="">element</var> to "span", and return
+ 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 the result.
</ol>
--- a/implementation.js Tue Jul 05 11:15:28 2011 -0600
+++ b/implementation.js Tue Jul 05 11:18:10 2011 -0600
@@ -2162,28 +2162,9 @@
return [];
}
- // "Let new element be a new HTML element with name "span", with the
- // same attributes and ownerDocument as element."
- var newElement = element.ownerDocument.createElement("span");
- for (var j = 0; j < element.attributes.length; j++) {
- // FIXME: Namespaces?
- newElement.setAttribute(element.attributes[j].localName, element.attributes[j].value);
- }
-
- // "Insert new element into the parent of element immediately before it."
- element.parentNode.insertBefore(newElement, element);
-
- // "While element has children, append its first child as the last child of
- // new element, preserving ranges."
- while (element.childNodes.length) {
- movePreservingRanges(element.firstChild, newElement, newElement.childNodes.length);
- }
-
- // "Remove element from its parent."
- element.parentNode.removeChild(element);
-
- // "Return the one-Node list consisting of new element."
- return [newElement];
+ // "Set the tag name of element to "span", and return the one-node list
+ // consisting of the result."
+ return [setTagName(element, "span")];
}
//@}
--- a/source.html Tue Jul 05 11:15:28 2011 -0600
+++ b/source.html Tue Jul 05 11:18:10 2011 -0600
@@ -1571,25 +1571,8 @@
<!-- If we get past this step, we're something like <b class=foo> where we
want to keep the extra attributes, so we stick them on a span. -->
- <p class=XXX>Replace the following steps with "set the tag name".
-
- <li>Let <var>new element</var> be a new <span>HTML element</span> with
- [[localname]] "span", with the same attributes and [[ownerdocument]] as
- <var>element</var>.
-
- <li>Insert <var>new element</var> into the [[parent]] of <var>element</var>
- immediately before it.
- <!-- This means that the boundary point immediately before the element goes
- before the new element, and after we remove the old element, the boundary
- point immediately after the old element will be immediately after the new
- element, because of the regular range mutation rules. -->
-
- <li>While <var>element</var> has [[children]], append its first [[child]] as
- the last [[child]] of <var>new element</var>, <span>preserving ranges</span>.
-
- <li>Remove <var>element</var> from its [[parent]].
-
- <li>Return the one-[[node]] list consisting of <var>new element</var>.
+ <li><span>Set the tag name</span> of <var>element</var> to "span", and return
+ the one-[[node]] list consisting of the result.
</ol>
<!-- @} -->