More or less working createLink
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Thu, 07 Apr 2011 13:58:56 -0600
changeset 47 cb313cb44512
parent 46 0043619ee7fc
child 48 7f271e7fde68
More or less working createLink
autoimplementation.html
editcommands.html
implementation.js
preprocess
source.html
--- a/autoimplementation.html	Thu Apr 07 13:13:00 2011 -0600
+++ b/autoimplementation.html	Thu Apr 07 13:58:56 2011 -0600
@@ -83,8 +83,7 @@
 
 <button onclick="runTests('createlink')">Run tests</button>
 
-<p>Tests set the href to "http://www.google.com/".  <strong>Note:</strong> The
-spec has known errors and its output should probably be ignored.
+<p>Tests set the href to "http://www.google.com/".
 
 <table border=1><tr><th>Input <th>Spec <th>Browser <th>Same?</table>
 
@@ -346,22 +345,24 @@
 		'<a href=http://www.google.com/>[foobarbaz]</a>',
 
 		'foo<a href=http://www.google.com/>[bar]</a>baz',
+		'[foo]<a href=http://www.google.com/>bar</a>baz',
+		'foo<a href=http://www.google.com/>bar</a>[baz]',
 		'foo[<a href=http://www.google.com/>bar</a>]baz',
 		'foo<a href=http://www.google.com/>[bar</a>baz]',
 		'[foo<a href=http://www.google.com/>bar]</a>baz',
 		'[foo<a href=http://www.google.com/>bar</a>baz]',
 
-		'<a href=http://google.com/>foo[bar]baz</a>',
-		'<a href=http://google.com/>foo[barbaz</a>}',
-		'{<a href=http://google.com/>foobar]baz</a>',
-		'{<a href=http://google.com/>foobarbaz</a>}',
-		'<a href=http://google.com/>[foobarbaz]</a>',
+		'<a href=otherurl>foo[bar]baz</a>',
+		'<a href=otherurl>foo[barbaz</a>}',
+		'{<a href=otherurl>foobar]baz</a>',
+		'{<a href=otherurl>foobarbaz</a>}',
+		'<a href=otherurl>[foobarbaz]</a>',
 
-		'foo<a href=http://google.com/>[bar]</a>baz',
-		'foo[<a href=http://google.com/>bar</a>]baz',
-		'foo<a href=http://google.com/>[bar</a>baz]',
-		'[foo<a href=http://google.com/>bar]</a>baz',
-		'[foo<a href=http://google.com/>bar</a>baz]',
+		'foo<a href=otherurl>[bar]</a>baz',
+		'foo[<a href=otherurl>bar</a>]baz',
+		'foo<a href=otherurl>[bar</a>baz]',
+		'[foo<a href=otherurl>bar]</a>baz',
+		'[foo<a href=otherurl>bar</a>baz]',
 	],
 	fontname: [
 		'foo[bar]baz',
--- a/editcommands.html	Thu Apr 07 13:13:00 2011 -0600
+++ b/editcommands.html	Thu Apr 07 13:58:56 2011 -0600
@@ -230,6 +230,17 @@
   <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, return the <a href=#effective-value>effective
   value</a> of 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> for <var title="">command</var>.
 
+  <li>If <var title="">command</var> is "createLink":
+
+  <ol>
+    <li>While <var title="">node</var> is not null, and is not an <code class=external data-anolis-spec=html title="the a element"><a href=http://www.whatwg.org/html/#the-a-element>a</a></code> element that has
+    an <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code> attribute, 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>If <var title="">node</var> is null, return null.
+
+    <li>Return the <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attr-value title=concept-attr-value>value</a> of <var title="">node</var>'s <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code> attribute.
+  </ol>
+
   <li>If <var title="">command</var> is "hiliteColor":
 
   <ol>
@@ -244,11 +255,6 @@
     <var title="">node</var>.
   </ol>
 
-  <li>If <var title="">command</var> is "underline", and the "text-decoration"
-  property of <var title="">node</var> or any of its <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>ancestors</a> computes to
-  a value containing "underline", return "underline".  Otherwise, return
-  "none".
-
   <li>If <var title="">command</var> is "subscript" or "superscript":
 
   <ol>
@@ -281,31 +287,45 @@
     <li>Return "baseline".
   </ol>
 
+  <li>If <var title="">command</var> is "underline", and the "text-decoration"
+  property of <var title="">node</var> or any of its <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>ancestors</a> computes to
+  a value containing "underline", return "underline".  Otherwise, return
+  "none".
+
   <li>Return the computed style for <var title="">node</var> of the <a href=#relevant-css-property>relevant CSS
   property</a> for <var title="">command</var>.
 </ol>
 
-<p>The <dfn id=specified-value>specified value</dfn> of 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> for a given
-<var title="">command</var> is returned by the following algorithm, which will return
-either a string or null:
+<p>The <dfn id=specified-value>specified value</dfn> of 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> <var title="">element</var> for a
+given <var title="">command</var> is returned by the following algorithm, which will
+return either a string or null:
 
 <ol>
   <li>If <var title="">command</var> is "hiliteColor" and the <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code>'s
   display property does not compute to "inline", return null.
 
+  <li>If <var title="">command</var> is "createLink":
+
+  <ol>
+    <li>If <var title="">element</var> is an <code class=external data-anolis-spec=html title="the a element"><a href=http://www.whatwg.org/html/#the-a-element>a</a></code> element and has an <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code>
+    attribute, return the <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attr-value title=concept-attr-value>value</a> of that attribute.
+
+    <li>Return null.
+  </ol>
+
   <li>If <var title="">command</var> is "subscript" or "superscript":
 
   <ol>
-    <li>If the computed value of the <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code>'s "display" property is
+    <li>If the computed value of <var title="">element</var>'s "display" property is
     neither "inline" nor "inline-block" nor "inline-table", return null.
 
-    <li>If the <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> 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 set, and that attribute
+    <li>If <var title="">element</var> 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 set, and that attribute
     has the effect of setting "vertical-align", return the value that it sets
     "vertical-align" to.
 
-    <li>If the <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> is a <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>, return "super".
+    <li>If <var title="">element</var> is a <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>, return "super".
 
-    <li>If the <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> is a <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>, return "sub".
+    <li>If <var title="">element</var> is a <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>, return "sub".
 
     <li>Return null.
   </ol>
@@ -315,15 +335,15 @@
 
   <li>If <var title="">property</var> is null, return null.
 
-  <li>If the <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> 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 set, and that attribute has
+  <li>If <var title="">element</var> 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 set, and that attribute has
   the effect of setting <var title="">property</var>, return the value that it sets
   <var title="">property</var> to.
 
-  <li>If the <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> is a <code class=external data-anolis-spec=html title=font><a href=http://www.whatwg.org/html/#font>font</a></code> element that has an attribute whose
+  <li>If <var title="">element</var> is a <code class=external data-anolis-spec=html title=font><a href=http://www.whatwg.org/html/#font>font</a></code> element that has an attribute whose
   effect is to create a <a class=external data-anolis-spec=html href=http://www.whatwg.org/html/#presentational-hints title="presentational hints">presentational hint</a> for <var title="">property</var>, return
   the value that the hint sets <var title="">property</var> to.
 
-  <li>If the <code class=external data-anolis-spec=domcore><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>Element</a></code> is in the following list, and <var title="">property</var> is
+  <li>If <var title="">element</var> is in the following list, and <var title="">property</var> is
   equal to the CSS property name listed for it, return the string listed for
   it.
 
@@ -345,19 +365,23 @@
 
 <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 span element"><a href=http://www.whatwg.org/html/#the-span-element>span</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 except
-possibly <code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code>, or a <code class=external data-anolis-spec=html title=font><a href=http://www.whatwg.org/html/#font>font</a></code> element with no attributes except possibly
-<code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code>, <code class=external data-anolis-spec=html title=dom-font-color><a href=http://www.whatwg.org/html/#dom-font-color>color</a></code>, <code class=external data-anolis-spec=html title=dom-font-face><a href=http://www.whatwg.org/html/#dom-font-face>face</a></code>, and/or <code class=external data-anolis-spec=html title=dom-font-size><a href=http://www.whatwg.org/html/#dom-font-size>size</a></code>.
+possibly <code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code>; or a <code class=external data-anolis-spec=html title=font><a href=http://www.whatwg.org/html/#font>font</a></code> element with no attributes except possibly
+<code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code>, <code class=external data-anolis-spec=html title=dom-font-color><a href=http://www.whatwg.org/html/#dom-font-color>color</a></code>, <code class=external data-anolis-spec=html title=dom-font-face><a href=http://www.whatwg.org/html/#dom-font-face>face</a></code>, and/or <code class=external data-anolis-spec=html title=dom-font-size><a href=http://www.whatwg.org/html/#dom-font-size>size</a></code>; or an <code class=external data-anolis-spec=html title="the a element"><a href=http://www.whatwg.org/html/#the-a-element>a</a></code>
+element with no attributes except possibly <code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code> and/or <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code>.
 
 <p>A <dfn id=simple-modifiable-element>simple modifiable element</dfn> is an <a href=#html-element>HTML element</a> for
 which at least one of the following holds:
 
 <ul>
-  <li>It 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=font><a href=http://www.whatwg.org/html/#font>font</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 span element"><a href=http://www.whatwg.org/html/#the-span-element>span</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.
+  <li>It is an <code class=external data-anolis-spec=html title="the a element"><a href=http://www.whatwg.org/html/#the-a-element>a</a></code>, <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=font><a href=http://www.whatwg.org/html/#font>font</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 span element"><a href=http://www.whatwg.org/html/#the-span-element>span</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.
 
-  <li>It 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=font><a href=http://www.whatwg.org/html/#font>font</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 span element"><a href=http://www.whatwg.org/html/#the-span-element>span</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 exactly one attribute, which is <code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code>,
-  which sets no CSS properties (including invalid or unrecognized properties).
+  <li>It is an <code class=external data-anolis-spec=html title="the a element"><a href=http://www.whatwg.org/html/#the-a-element>a</a></code>, <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=font><a href=http://www.whatwg.org/html/#font>font</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 span element"><a href=http://www.whatwg.org/html/#the-span-element>span</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 exactly one attribute, which is
+  <code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code>, which sets no CSS properties (including invalid or unrecognized
+  properties).
+
+  <li>It is an <code class=external data-anolis-spec=html title="the a element"><a href=http://www.whatwg.org/html/#the-a-element>a</a></code> element with exactly one attribute, which is <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code>.
 
   <li>It is a <code class=external data-anolis-spec=html title=font><a href=http://www.whatwg.org/html/#font>font</a></code> element with exactly one attribute, which is either
   <code class=external data-anolis-spec=html title=dom-font-color><a href=http://www.whatwg.org/html/#dom-font-color>color</a></code>, <code class=external data-anolis-spec=html title=dom-font-face><a href=http://www.whatwg.org/html/#dom-font-face>face</a></code>, or <code class=external data-anolis-spec=html title=dom-font-size><a href=http://www.whatwg.org/html/#dom-font-size>size</a></code>.
@@ -375,12 +399,12 @@
   unrecognized properties), which is "text-decoration", which is set to
   "underline" or "none".
 
-  <li>It is a <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> or <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> element with exactly one attribute, which is
+  <li>It is a <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> or <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> element with exactly one attribute, which is
   <code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code>, and the <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 sets exactly one CSS property
   (including invalid or unrecognized properties), which is "vertical-align".
 
-  <li>It is a <code class=external data-anolis-spec=html title=font><a href=http://www.whatwg.org/html/#font>font</a></code> or <code class=external data-anolis-spec=html title="the span element"><a href=http://www.whatwg.org/html/#the-span-element>span</a></code> element with exactly one attribute, which is
-  <code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code>, and the <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 sets exactly one CSS property
+  <li>It is an <code class=external data-anolis-spec=html title="the a element"><a href=http://www.whatwg.org/html/#the-a-element>a</a></code>, <code class=external data-anolis-spec=html title=font><a href=http://www.whatwg.org/html/#font>font</a></code>, or <code class=external data-anolis-spec=html title="the span element"><a href=http://www.whatwg.org/html/#the-span-element>span</a></code> element with exactly one attribute,
+  which is <code class=external data-anolis-spec=html title="the style attribute"><a href=http://www.whatwg.org/html/#the-style-attribute>style</a></code>, and the <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 sets exactly one CSS property
   (including invalid or unrecognized properties).
 </ul>
 
@@ -539,6 +563,9 @@
     <code class=external data-anolis-spec=html title=dom-font-size><a href=http://www.whatwg.org/html/#dom-font-size>size</a></code> attribute, if set.
   </ol>
 
+  <li>If <var title="">element</var> is an <code class=external data-anolis-spec=html title="the a element"><a href=http://www.whatwg.org/html/#the-a-element>a</a></code> element and <var title="">command</var> is
+  "createLink", unset the <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code> property of <var title="">element</var>.
+
   <li>If <var title="">element</var>'s <a href=#specified-value>specified value</a> for
   <var title="">command</var> is null, return the empty list.
   <!-- If we get past this step, we're something like <b class=foo> where we
@@ -854,6 +881,11 @@
     of <var title="">new parent</var> to <var title="">new value</var>.
   </ol>
 
+  <li>If <var title="">command</var> is "createLink", let <var title="">new parent</var> be the
+  result of calling <code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("a")</a></code> on the
+  <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> of <var title="">node</var>, then set the <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code> attribute of
+  <var title="">new parent</var> to <var title="">new value</var>.
+
   <!-- We always use sup/sub elements, even in CSS mode, following Gecko and
   contradicting WebKit.  This is because <span value="vertical-align:
   sub/super">, the obvious equivalent (and what WebKit uses), behaves quite
@@ -1165,68 +1197,37 @@
   specify "#" for the value, or the author can rewrite it, so it's not like
   this makes the API less useful. -->
 
-  <li>Let <var title="">node list</var> be the result of <a href=#decompose title=decompose>decomposing</a> the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range title=concept-range>range</a>.
-
-  <li>For each <var title="">node</var> in <var title="">node list</var>, in order:
-
-  <ol>
-    <li>Let <var title="">text nodes</var> be a list of all <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
-    <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>descendants</a> of <var title="">node</var>, or <var title="">node</var> itself if it's 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.
-
-    <li>For each <var title="">text node</var> in <var title="">text nodes</var>:
-
-    <ol>
-      <li>Let <var title="">ancestor link</var> be the parent of <var title="">text
-      node</var>.
-
-      <li>While <var title="">ancestor link</var> is not an <code class=external data-anolis-spec=html title="the a element"><a href=http://www.whatwg.org/html/#the-a-element>a</a></code> element or has no <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code> attribute:
-
-      <ol>
-        <li>If the parent of <var title="">ancestor link</var> is not 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>,
-        set <var title="">ancestor link</var> to null and break from this loop.
-
-        <li>Otherwise, set <var title="">ancestor link</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>.
-      </ol>
-
-      <li>If <var title="">ancestor link</var> is not null, set its <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code> attribute
-      to <var title="">value</var> and continue with the next <var title="">text node</var>.
-      <!-- There are three approaches here.  For instance, if you ask browsers
-      to create a link to "http://example.org" on the "b" here:
-
-        <a href=http://example.com><b>Abc</b></a>
+  <li><a href=#decompose>Decompose</a> the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range title=concept-range>range</a>, and let <var title="">node list</var> be the
+  result.
 
-      Chrome 10 dev produces:
-
-        <b><a href=http://example.com>A</a><a href=http://example.org>b</a>
-        <a href=http://example.com>c</a></b>
-
-      Firefox 4b11 produces (roughly):
-
-        <a href=http://example.com><b>A<a href=http://example.org>b</a>c</b></a>
-
-      IE 9 RC and Opera 11 produce simply:
-
-        <a href=http://example.org><b>Abc</b></a>
+  <li>For each <code class=external data-anolis-spec=html title="the a element"><a href=http://www.whatwg.org/html/#the-a-element>a</a></code> element that has an <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code> attribute and is an
+  <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 some <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> in <var title="">node list</var>, set that element's
+  <code class=external data-anolis-spec=html title=attr-hyperlink-href><a href=http://www.whatwg.org/html/#attr-hyperlink-href>href</a></code> attribute to <var title="">value</var>.
+  <!-- There are three approaches here.  For instance, if you ask browsers to
+  create a link to "http://example.org" on the "b" here:
 
-      The last behavior produces valid markup (unlike Gecko), is simple (unlike
-      WebKit), and probably best matches user expectations.  If you happen to
-      miss out a character when selecting the link you want to change, do you
-      really intend to only change the link of part of it? -->
-
-      <li>Let <var title="">new parent</var> be the result of calling <code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("a")</a></code> on the
-      <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> of <var title="">text node</var>.
+    <a href=http://example.com><b>Abc</b></a>
 
-      <li>Call <code class=external data-anolis-spec=domcore title=dom-Element-setAttribute><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-element-setattribute>setAttribute("href",
-      <var title="">value</var>)</a></code> on <var title="">new parent</var>.
+  Chrome 10 dev produces:
 
-      <li>Insert <var title="">new parent</var> into <var title="">text node</var>'s parent as
-      the previous sibling of <var title="">text node</var>.
+    <b><a href=http://example.com>A</a><a href=http://example.org>b</a>
+    <a href=http://example.com>c</a></b>
 
-      <li>Append <var title="">text node</var> to <var title="">new parent</var> as its last
-      child, <a href=#preserving-ranges>preserving ranges</a>.
-    </ol>
-  </ol>
+  Firefox 4b11 produces (roughly):
+
+    <a href=http://example.com><b>A<a href=http://example.org>b</a>c</b></a>
+
+  IE 9 RC and Opera 11 produce simply:
+
+    <a href=http://example.org><b>Abc</b></a>
+
+  The last behavior produces valid markup (unlike Gecko), is simple (unlike
+  WebKit), and probably best matches user expectations.  If you happen to miss
+  out a character when selecting the link you want to change, do you really
+  intend to only change the link of part of it? -->
+
+  <li><a href=#set-the-value>Set the value</a> of each <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> in <var title="">node list</var> to
+  <var title="">value</var>.
 </ol>
 
 <dd><strong>State</strong>: Always false.
--- a/implementation.js	Thu Apr 07 13:13:00 2011 -0600
+++ b/implementation.js	Thu Apr 07 13:58:56 2011 -0600
@@ -299,6 +299,26 @@
 		return getEffectiveValue(node.parentNode, command);
 	}
 
+	// "If command is "createLink":"
+	if (command == "createlink") {
+		// "While node is not null, and is not an a element that has an href
+		// attribute, set node to its parent."
+		while (node
+		&& (!isHtmlElement(node)
+		|| node.tagName != "A"
+		|| !node.hasAttribute("href"))) {
+			node = node.parentNode;
+		}
+
+		// "If node is null, return null."
+		if (!node) {
+			return null;
+		}
+
+		// "Return the value of node's href attribute."
+		return node.getAttribute("href");
+	}
+
 	// "If command is "hiliteColor":"
 	if (command == "hilitecolor") {
 		// "While the computed style of "background-color" on node is any
@@ -327,19 +347,6 @@
 		return getComputedStyle(node).backgroundColor;
 	}
 
-	// "If command is "underline", and the "text-decoration" property of node
-	// or any of its ancestors computes to a value containing "underline",
-	// return "underline". Otherwise, return "none"."
-	if (command == "underline") {
-		do {
-			if ((" " + getComputedStyle(node).textDecoration + " ").indexOf(" underline ") != -1) {
-				return "underline";
-			}
-			node = node.parentNode;
-		} while (node && node.nodeType == Node.ELEMENT_NODE);
-		return "none";
-	}
-
 	// "If command is "subscript" or "superscript":"
 	if (command == "subscript" || command == "superscript") {
 		// "Let affected by subscript and affected by superscript be two
@@ -392,6 +399,19 @@
 		return "baseline";
 	}
 
+	// "If command is "underline", and the "text-decoration" property of node
+	// or any of its ancestors computes to a value containing "underline",
+	// return "underline". Otherwise, return "none"."
+	if (command == "underline") {
+		do {
+			if ((" " + getComputedStyle(node).textDecoration + " ").indexOf(" underline ") != -1) {
+				return "underline";
+			}
+			node = node.parentNode;
+		} while (node && node.nodeType == Node.ELEMENT_NODE);
+		return "none";
+	}
+
 	// "Return the computed style for node of the relevant CSS property for
 	// command."
 	return getComputedStyle(node)[getRelevantCssProperty(command)];
@@ -401,16 +421,30 @@
  * "specified value" per edit command spec
  */
 function getSpecifiedValue(element, command) {
-	// "If command is "hiliteColor" and the Element's display property does not
+	// "If command is "hiliteColor" and element's display property does not
 	// compute to "inline", return null."
 	if (command == "hilitecolor"
 	&& getComputedStyle(element).display != "inline") {
 		return null;
 	}
 
+	// "If command is "createLink":"
+	if (command == "createlink") {
+		// "If element is an a element and has an href attribute, return the
+		// value of that attribute."
+		if (isHtmlElement(element)
+		&& element.tagName == "A"
+		&& element.hasAttribute("href")) {
+			return element.getAttribute("href");
+		}
+
+		// "Return null."
+		return null;
+	}
+
 	// "If command is "subscript" or "superscript":"
 	if (command == "subscript" || command == "superscript") {
-		// "If the computed style of the Element's "display" property is
+		// "If the computed style of element's "display" property is
 		// neither "inline" nor "inline-block" nor "inline-table", return
 		// null."
 		var style = getComputedStyle(element);
@@ -420,19 +454,19 @@
 			return null;
 		}
 
-		// "If the Element has a style attribute set, and that attribute has
+		// "If element has a style attribute set, and that attribute has
 		// the effect of setting "vertical-align", return the value that it
 		// sets "vertical-align" to."
 		if (element.style.verticalAlign != "") {
 			return element.style.verticalAlign;
 		}
 
-		// "If the Element is a sup, return "super"."
+		// "If element is a sup, return "super"."
 		if (isHtmlElement(element) && element.tagName == "SUP") {
 			return "super";
 		}
 
-		// "If the Element is a sub, return "sub"."
+		// "If element is a sub, return "sub"."
 		if (isHtmlElement(element) && element.tagName == "SUB") {
 			return "sub";
 		}
@@ -449,13 +483,13 @@
 		return null;
 	}
 
-	// "If the Element has a style attribute set, and that attribute has the
+	// "If element has a style attribute set, and that attribute has the
 	// effect of setting property, return the value that it sets property to."
 	if (element.style[property] != "") {
 		return element.style[property];
 	}
 
-	// "If the Element is a font element that has an attribute whose effect is
+	// "If element is a font element that has an attribute whose effect is
 	// to create a presentational hint for property, return the value that the
 	// hint sets property to."
 	//
@@ -474,7 +508,7 @@
 		}
 	}
 
-	// "If the Element is in the following list, and property is equal to the
+	// "If element is in the following list, and property is equal to the
 	// CSS property name listed for it, return the string listed for it."
 	//
 	// A list follows, whose meaning is copied here.
@@ -495,9 +529,10 @@
 	return null;
 }
 
-// "A modifiable element is a b, em, i, span, strong, sub, sup, or u element with
-// no attributes except possibly style, or a font element with no attributes
-// except possibly style, color, face, and/or size."
+// "A modifiable element is a b, em, i, span, strong, sub, sup, or u element
+// with no attributes except possibly style; or a font element with no
+// attributes except possibly style, color, face, and/or size; or an a element
+// with no attributes except possibly style and/or href."
 function isModifiableElement(node) {
 	if (!isHtmlElement(node)) {
 		return false;
@@ -514,22 +549,29 @@
 		}
 	}
 
-	if (node.tagName == "FONT") {
+	if (node.tagName == "FONT" || node.tagName == "A") {
 		var numAttrs = node.attributes.length;
 
 		if (node.hasAttribute("style")) {
 			numAttrs--;
 		}
 
-		if (node.hasAttribute("color")) {
-			numAttrs--;
+		if (node.tagName == "FONT") {
+			if (node.hasAttribute("color")) {
+				numAttrs--;
+			}
+
+			if (node.hasAttribute("face")) {
+				numAttrs--;
+			}
+
+			if (node.hasAttribute("size")) {
+				numAttrs--;
+			}
 		}
 
-		if (node.hasAttribute("face")) {
-			numAttrs--;
-		}
-
-		if (node.hasAttribute("size")) {
+		if (node.tagName == "A"
+		&& node.hasAttribute("href")) {
 			numAttrs--;
 		}
 
@@ -549,12 +591,12 @@
 	}
 
 	// Only these elements can possibly be a simple modifiable element.
-	if (["B", "EM", "FONT", "I", "SPAN", "STRONG", "SUB", "SUP", "U"].indexOf(node.tagName) == -1) {
+	if (["A", "B", "EM", "FONT", "I", "SPAN", "STRONG", "SUB", "SUP", "U"].indexOf(node.tagName) == -1) {
 		return false;
 	}
 
-	// "It is a b, em, font, i, span, strong, sub, sup, or u element with no
-	// attributes."
+	// "It is an a, b, em, font, i, span, strong, sub, sup, or u element with
+	// no attributes."
 	if (node.attributes.length == 0) {
 		return true;
 	}
@@ -564,7 +606,7 @@
 		return false;
 	}
 
-	// "It is a b, em, font, i, span, strong, sub, sup, or u element with
+	// "It is an a, b, em, font, i, span, strong, sub, sup, or u element with
 	// exactly one attribute, which is style, which sets no CSS properties
 	// (including invalid or unrecognized properties)."
 	//
@@ -574,6 +616,12 @@
 		return true;
 	}
 
+	// "It is an a element with exactly one attribute, which is href."
+	if (node.tagName == "A"
+	&& node.hasAttribute("href")) {
+		return true;
+	}
+
 	// "It is a font element with exactly one attribute, which is either color,
 	// face, or size."
 	if (node.tagName == "FONT"
@@ -626,10 +674,10 @@
 		return true;
 	}
 
-	// "It is a font or span element with exactly one attribute, which is
+	// "It is an a, font, or span element with exactly one attribute, which is
 	// style, and the style attribute sets exactly one CSS property (including
 	// invalid or unrecognized properties)."
-	if ((node.tagName == "FONT" || node.tagName == "SPAN")
+	if ((node.tagName == "A" || node.tagName == "FONT" || node.tagName == "SPAN")
 	&& node.hasAttribute("style")
 	&& node.style.length == 1) {
 		return true;
@@ -830,6 +878,14 @@
 		}
 	}
 
+	// "If element is an a element and command is "createLink", unset the href
+	// property of element."
+	if (isHtmlElement(element)
+	&& element.tagName == "A"
+	&& command == "createlink") {
+		element.removeAttribute("href");
+	}
+
 	// "If element's specified value for command is null, return the empty
 	// list."
 	if (getSpecifiedValue(element, command) === null) {
@@ -1178,6 +1234,14 @@
 		}
 	}
 
+	// "If command is "createLink", let new parent be the result of calling
+	// createElement("a") on the ownerDocument of node, then set the href
+	// attribute of new parent to new value."
+	if (command == "createlink") {
+		newParent = node.ownerDocument.createElement("a");
+		newParent.setAttribute("href", newValue);
+	}
+
 	// "If command is "subscript" and new value is "sub", let new parent be the
 	// result of calling createElement("sub") on the ownerDocument of node."
 	if (command == "subscript" && newValue == "sub") {
@@ -1369,80 +1433,32 @@
 		break;
 
 		case "createlink":
-		// "If value is the empty string, do nothing."
+		// "If value is the empty string, abort these steps and do nothing."
 		if (value === "") {
 			break;
 		}
 
-		// "Let node list be the result of decomposing the Range."
+		// "Decompose the range, and let node list be the result."
 		var nodeList = decomposeRange(range);
 
-		// "For each node in node list, in order:"
+		// "For each a element that has an href attribute and is an ancestor of
+		// some node in node list, set that element's href attribute to value."
 		for (var i = 0; i < nodeList.length; i++) {
-			var node = nodeList[i];
-
-			// "Let text nodes be a list of all Text node descendants of node,
-			// or node itself if it's a Text node."
-			var textNodes = [];
-			if (node.nodeType == Node.TEXT_NODE) {
-				textNodes.push(node);
-			} else {
-				for (var cur = node.firstChild;
-				cur && cur.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINS;
-				cur = nextNode(cur)) {
-					if (cur.nodeType == Node.TEXT_NODE) {
-						textNodes.push(cur);
-					}
-				}
-			}
-
-			// "For each text node in text nodes:"
-			for (var j = 0; j < textNodes.length; j++) {
-				var textNode = textNodes[j];
-
-				// "Let ancestor link be the parent of text node."
-				var ancestorLink = textNode.parentNode;
-
-				// "While ancestor link is not an a element or has no href
-				// attribute:"
-				while (!isHtmlNamespace(ancestorLink.namespaceURI)
-				|| ancestorLink.nodeType != Node.ELEMENT_NODE
-				|| ancestorLink.tagName != "A"
-				|| !ancestorLink.hasAttribute("href")) {
-					// "If the parent of ancestor link is not an Element, set
-					// ancestor link to null and break from this loop."
-					if (!ancestorLink.parentNode
-					|| ancestorLink.parentNode.nodeType != Node.ELEMENT_NODE) {
-						ancestorLink = null;
-						break;
-					}
-
-					// "Otherwise, set ancestor link to its parent."
-					ancestorLink = ancestorLink.parentNode;
+			var candidate = nodeList[i].parentNode;
+			while (candidate) {
+				if (isHtmlElement(candidate)
+				&& candidate.tagName == "A"
+				&& candidate.hasAttribute("href")) {
+					candidate.setAttribute("href", value);
 				}
 
-				// "If ancestor link is not null, set its href attribute to
-				// value and continue with the next text node."
-				if (ancestorLink) {
-					ancestorLink.setAttribute("href", value);
-					continue;
-				}
-
-				// "Let new parent be the result of calling createElement("a")
-				// on the ownerDocument of text node."
-				var newParent = textNode.ownerDocument.createElement("a");
+				candidate = candidate.parentNode;
+			}
+		}
 
-				// "Call setAttribute("href", value) on new parent."
-				newParent.setAttribute("href", value);
-
-				// "Insert new parent into text node's parent as the previous
-				// sibling of text node."
-				textNode.parentNode.insertBefore(newParent, textNode);
-
-				// "Append text node to new parent as its last child,
-				// preserving ranges."
-				movePreservingRanges(textNode, newParent, 0);
-			}
+		// "Set the value of each node in node list to value."
+		for (var i = 0; i < nodeList.length; i++) {
+			setNodeValue(nodeList[i], command, value);
 		}
 		break;
 
--- a/preprocess	Thu Apr 07 13:13:00 2011 -0600
+++ b/preprocess	Thu Apr 07 13:58:56 2011 -0600
@@ -6,6 +6,7 @@
 # in Anolis proper.
 
 replace = {
+    'a': '<code data-anolis-spec=html title="the a element">a</code>',
     'ancestor': '<span data-anolis-spec=domcore title=concept-tree-ancestor>ancestor</span>',
     'attrlocalname': '<span data-anolis-spec=domcore title=concept-attr-local-name>local name</span>',
     'attrvalue': '<span data-anolis-spec=domcore title=concept-attr-value>value</span>',
--- a/source.html	Thu Apr 07 13:13:00 2011 -0600
+++ b/source.html	Thu Apr 07 13:58:56 2011 -0600
@@ -219,6 +219,17 @@
   <li>If <var>node</var> is a [[text]] node, return the <span>effective
   value</span> of its [[parent]] for <var>command</var>.
 
+  <li>If <var>command</var> is "createLink":
+
+  <ol>
+    <li>While <var>node</var> is not null, and is not an [[a]] element that has
+    an [[href]] attribute, set <var>node</var> to its [[parent]].
+
+    <li>If <var>node</var> is null, return null.
+
+    <li>Return the [[attrvalue]] of <var>node</var>'s [[href]] attribute.
+  </ol>
+
   <li>If <var>command</var> is "hiliteColor":
 
   <ol>
@@ -233,11 +244,6 @@
     <var>node</var>.
   </ol>
 
-  <li>If <var>command</var> is "underline", and the "text-decoration"
-  property of <var>node</var> or any of its [[ancestors]] computes to
-  a value containing "underline", return "underline".  Otherwise, return
-  "none".
-
   <li>If <var>command</var> is "subscript" or "superscript":
 
   <ol>
@@ -270,31 +276,45 @@
     <li>Return "baseline".
   </ol>
 
+  <li>If <var>command</var> is "underline", and the "text-decoration"
+  property of <var>node</var> or any of its [[ancestors]] computes to
+  a value containing "underline", return "underline".  Otherwise, return
+  "none".
+
   <li>Return the computed style for <var>node</var> of the <span>relevant CSS
   property</span> for <var>command</var>.
 </ol>
 
-<p>The <dfn>specified value</dfn> of an [[element]] for a given
-<var>command</var> is returned by the following algorithm, which will return
-either a string or null:
+<p>The <dfn>specified value</dfn> of an [[element]] <var>element</var> for a
+given <var>command</var> is returned by the following algorithm, which will
+return either a string or null:
 
 <ol>
   <li>If <var>command</var> is "hiliteColor" and the [[element]]'s
   display property does not compute to "inline", return null.
 
+  <li>If <var>command</var> is "createLink":
+
+  <ol>
+    <li>If <var>element</var> is an [[a]] element and has an [[href]]
+    attribute, return the [[attrvalue]] of that attribute.
+
+    <li>Return null.
+  </ol>
+
   <li>If <var>command</var> is "subscript" or "superscript":
 
   <ol>
-    <li>If the computed value of the [[element]]'s "display" property is
+    <li>If the computed value of <var>element</var>'s "display" property is
     neither "inline" nor "inline-block" nor "inline-table", return null.
 
-    <li>If the [[element]] has a [[style]] attribute set, and that attribute
+    <li>If <var>element</var> has a [[style]] attribute set, and that attribute
     has the effect of setting "vertical-align", return the value that it sets
     "vertical-align" to.
 
-    <li>If the [[element]] is a [[sup]], return "super".
+    <li>If <var>element</var> is a [[sup]], return "super".
 
-    <li>If the [[element]] is a [[sub]], return "sub".
+    <li>If <var>element</var> is a [[sub]], return "sub".
 
     <li>Return null.
   </ol>
@@ -304,15 +324,15 @@
 
   <li>If <var>property</var> is null, return null.
 
-  <li>If the [[element]] has a [[style]] attribute set, and that attribute has
+  <li>If <var>element</var> has a [[style]] attribute set, and that attribute has
   the effect of setting <var>property</var>, return the value that it sets
   <var>property</var> to.
 
-  <li>If the [[element]] is a [[font]] element that has an attribute whose
+  <li>If <var>element</var> is a [[font]] element that has an attribute whose
   effect is to create a [[presentationalhint]] for <var>property</var>, return
   the value that the hint sets <var>property</var> to.
 
-  <li>If the [[element]] is in the following list, and <var>property</var> is
+  <li>If <var>element</var> is in the following list, and <var>property</var> is
   equal to the CSS property name listed for it, return the string listed for
   it.
 
@@ -334,19 +354,23 @@
 
 <p>A <dfn>modifiable element</dfn> is a [[b]], [[em]], [[i]], [[span]],
 [[strong]], [[sub]], [[sup]], or [[u]] element with no attributes except
-possibly [[style]], or a [[font]] element with no attributes except possibly
-[[style]], [[fontcolor]], [[fontface]], and/or [[fontsize]].
+possibly [[style]]; or a [[font]] element with no attributes except possibly
+[[style]], [[fontcolor]], [[fontface]], and/or [[fontsize]]; or an [[a]]
+element with no attributes except possibly [[style]] and/or [[href]].
 
 <p>A <dfn>simple modifiable element</dfn> is an <span>HTML element</span> for
 which at least one of the following holds:
 
 <ul>
-  <li>It is a [[b]], [[em]], [[font]], [[i]], [[span]], [[strong]], [[sub]],
-  [[sup]], or [[u]] element with no attributes.
+  <li>It is an [[a]], [[b]], [[em]], [[font]], [[i]], [[span]], [[strong]],
+  [[sub]], [[sup]], or [[u]] element with no attributes.
 
-  <li>It is a [[b]], [[em]], [[font]], [[i]], [[span]], [[strong]], [[sub]],
-  [[sup]], or [[u]] element with exactly one attribute, which is [[style]],
-  which sets no CSS properties (including invalid or unrecognized properties).
+  <li>It is an [[a]], [[b]], [[em]], [[font]], [[i]], [[span]], [[strong]],
+  [[sub]], [[sup]], or [[u]] element with exactly one attribute, which is
+  [[style]], which sets no CSS properties (including invalid or unrecognized
+  properties).
+
+  <li>It is an [[a]] element with exactly one attribute, which is [[href]].
 
   <li>It is a [[font]] element with exactly one attribute, which is either
   [[fontcolor]], [[fontface]], or [[fontsize]].
@@ -364,12 +388,12 @@
   unrecognized properties), which is "text-decoration", which is set to
   "underline" or "none".
 
-  <li>It is a [[sub]] or [[sub]] element with exactly one attribute, which is
+  <li>It is a [[sub]] or [[sup]] element with exactly one attribute, which is
   [[style]], and the [[style]] attribute sets exactly one CSS property
   (including invalid or unrecognized properties), which is "vertical-align".
 
-  <li>It is a [[font]] or [[span]] element with exactly one attribute, which is
-  [[style]], and the [[style]] attribute sets exactly one CSS property
+  <li>It is an [[a]], [[font]], or [[span]] element with exactly one attribute,
+  which is [[style]], and the [[style]] attribute sets exactly one CSS property
   (including invalid or unrecognized properties).
 </ul>
 
@@ -532,6 +556,9 @@
     [[fontsize]] attribute, if set.
   </ol>
 
+  <li>If <var>element</var> is an [[a]] element and <var>command</var> is
+  "createLink", unset the [[href]] property of <var>element</var>.
+
   <li>If <var>element</var>'s <span>specified value</span> for
   <var>command</var> is null, return the empty list.
   <!-- If we get past this step, we're something like <b class=foo> where we
@@ -857,6 +884,12 @@
     of <var>new parent</var> to <var>new value</var>.
   </ol>
 
+  <li>If <var>command</var> is "createLink", let <var>new parent</var> be the
+  result of calling <code data-anolis-spec=domcore
+  title=dom-Document-createElement>createElement("a")</code> on the
+  [[ownerdocument]] of <var>node</var>, then set the [[href]] attribute of
+  <var>new parent</var> to <var>new value</var>.
+
   <!-- We always use sup/sub elements, even in CSS mode, following Gecko and
   contradicting WebKit.  This is because <span value="vertical-align:
   sub/super">, the obvious equivalent (and what WebKit uses), behaves quite
@@ -1177,73 +1210,37 @@
   specify "#" for the value, or the author can rewrite it, so it's not like
   this makes the API less useful. -->
 
-  <li>Let <var>node list</var> be the result of <span
-  title=decompose>decomposing</span> the [[range]].
-
-  <li>For each <var>node</var> in <var>node list</var>, in order:
-
-  <ol>
-    <li>Let <var>text nodes</var> be a list of all [[text]] node
-    [[descendants]] of <var>node</var>, or <var>node</var> itself if it's a
-    [[text]] node.
-
-    <li>For each <var>text node</var> in <var>text nodes</var>:
-
-    <ol>
-      <li>Let <var>ancestor link</var> be the parent of <var>text
-      node</var>.
-
-      <li>While <var>ancestor link</var> is not an <code data-anolis-spec=html
-      title="the a element">a</code> element or has no [[href]] attribute:
-
-      <ol>
-        <li>If the parent of <var>ancestor link</var> is not an [[element]],
-        set <var>ancestor link</var> to null and break from this loop.
-
-        <li>Otherwise, set <var>ancestor link</var> to its [[parent]].
-      </ol>
-
-      <li>If <var>ancestor link</var> is not null, set its [[href]] attribute
-      to <var>value</var> and continue with the next <var>text node</var>.
-      <!-- There are three approaches here.  For instance, if you ask browsers
-      to create a link to "http://example.org" on the "b" here:
-
-        <a href=http://example.com><b>Abc</b></a>
+  <li><span>Decompose</span> the [[range]], and let <var>node list</var> be the
+  result.
 
-      Chrome 10 dev produces:
-
-        <b><a href=http://example.com>A</a><a href=http://example.org>b</a>
-        <a href=http://example.com>c</a></b>
-
-      Firefox 4b11 produces (roughly):
-
-        <a href=http://example.com><b>A<a href=http://example.org>b</a>c</b></a>
-
-      IE 9 RC and Opera 11 produce simply:
-
-        <a href=http://example.org><b>Abc</b></a>
+  <li>For each [[a]] element that has an [[href]] attribute and is an
+  [[ancestor]] of some [[node]] in <var>node list</var>, set that element's
+  [[href]] attribute to <var>value</var>.
+  <!-- There are three approaches here.  For instance, if you ask browsers to
+  create a link to "http://example.org" on the "b" here:
 
-      The last behavior produces valid markup (unlike Gecko), is simple (unlike
-      WebKit), and probably best matches user expectations.  If you happen to
-      miss out a character when selecting the link you want to change, do you
-      really intend to only change the link of part of it? -->
-
-      <li>Let <var>new parent</var> be the result of calling <code
-      data-anolis-spec=domcore
-      title=dom-Document-createElement>createElement("a")</code> on the
-      [[ownerdocument]] of <var>text node</var>.
+    <a href=http://example.com><b>Abc</b></a>
 
-      <li>Call <code data-anolis-spec=domcore
-      title=dom-Element-setAttribute>setAttribute("href",
-      <var>value</var>)</code> on <var>new parent</var>.
+  Chrome 10 dev produces:
 
-      <li>Insert <var>new parent</var> into <var>text node</var>'s parent as
-      the previous sibling of <var>text node</var>.
+    <b><a href=http://example.com>A</a><a href=http://example.org>b</a>
+    <a href=http://example.com>c</a></b>
 
-      <li>Append <var>text node</var> to <var>new parent</var> as its last
-      child, <span>preserving ranges</span>.
-    </ol>
-  </ol>
+  Firefox 4b11 produces (roughly):
+
+    <a href=http://example.com><b>A<a href=http://example.org>b</a>c</b></a>
+
+  IE 9 RC and Opera 11 produce simply:
+
+    <a href=http://example.org><b>Abc</b></a>
+
+  The last behavior produces valid markup (unlike Gecko), is simple (unlike
+  WebKit), and probably best matches user expectations.  If you happen to miss
+  out a character when selecting the link you want to change, do you really
+  intend to only change the link of part of it? -->
+
+  <li><span>Set the value</span> of each [[node]] in <var>node list</var> to
+  <var>value</var>.
 </ol>
 
 <dd><strong>State</strong>: Always false.