[html5] r1276 - /

whatwg at whatwg.org whatwg at whatwg.org
Thu Feb 28 17:56:25 PST 2008


Author: ianh
Date: 2008-02-28 17:56:24 -0800 (Thu, 28 Feb 2008)
New Revision: 1276

Modified:
   index
   source
Log:
[e] (0) Clarify the serialisation algorithm by not saying 'child node' so much.

Modified: index
===================================================================
--- index	2008-02-29 01:22:51 UTC (rev 1275)
+++ index	2008-02-29 01:56:24 UTC (rev 1276)
@@ -43682,117 +43682,132 @@
      string.
 
    <li>
-    <p>For each child node <var title="">child</var> of <var title="">the
-     node</var>, in <a href="#tree-order">tree order</a>, append the
-     appropriate string from the following list to <var title="">s</var>:</p>
+    <p>For each child node of <var title="">the node</var>, in <a
+     href="#tree-order">tree order</a>, run the following steps:
 
-    <dl class=switch>
-     <dt>If the child node is an <code title="">Element</code>
+    <ol>
+     <li>
+      <p>Let <var title="">current node</var> be the child node being
+       processed.
 
-     <dd>
-      <p>Append a U+003C LESS-THAN SIGN (<code title=""><</code>)
-       character, followed by the element's tag name. (For nodes created by
-       the <a href="#html-0">HTML parser</a>, <code
-       title="">Document.createElement()</code>, or <code
-       title="">Document.renameNode()</code>, the tag name will be
-       lowercase.)</p>
+     <li>
+      <p>Append the appropriate string from the following list to <var
+       title="">s</var>:</p>
 
-      <p>For each attribute that the element has, append a U+0020 SPACE
-       character, the attribute's name (which, for attributes set by the <a
-       href="#html-0">HTML parser</a> or by <code
-       title="">Element.setAttributeNode()</code> or <code
-       title="">Element.setAttribute()</code>, will be lowercase), a U+003D
-       EQUALS SIGN (<code title="">=</code>) character, a U+0022 QUOTATION
-       MARK (<code title="">"</code>) character, the attribute's value,
-       <a href="#escapingString" title="escaping a string">escaped as
-       described below</a>, and a second U+0022 QUOTATION MARK (<code
-       title="">"</code>) character.</p>
+      <dl class=switch>
+       <dt>If <var title="">current node</var> is an <code
+        title="">Element</code>
 
-      <p>While the exact order of attributes is UA-defined, and may depend on
-       factors such as the order that the attributes were given in the
-       original markup, the sort order must be stable, such that consecutive
-       invocations of this algorithm serialise an element's attributes in the
-       same order.</p>
+       <dd>
+        <p>Append a U+003C LESS-THAN SIGN (<code title=""><</code>)
+         character, followed by the element's tag name. (For nodes created by
+         the <a href="#html-0">HTML parser</a>, <code
+         title="">Document.createElement()</code>, or <code
+         title="">Document.renameNode()</code>, the tag name will be
+         lowercase.)</p>
 
-      <p>Append a U+003E GREATER-THAN SIGN (<code title="">></code>)
-       character.</p>
+        <p>For each attribute that the element has, append a U+0020 SPACE
+         character, the attribute's name (which, for attributes set by the <a
+         href="#html-0">HTML parser</a> or by <code
+         title="">Element.setAttributeNode()</code> or <code
+         title="">Element.setAttribute()</code>, will be lowercase), a U+003D
+         EQUALS SIGN (<code title="">=</code>) character, a U+0022 QUOTATION
+         MARK (<code title="">"</code>) character, the attribute's
+         value, <a href="#escapingString" title="escaping a string">escaped
+         as described below</a>, and a second U+0022 QUOTATION MARK (<code
+         title="">"</code>) character.</p>
 
-      <p>If the child node is an <code><a href="#area">area</a></code>,
-       <code><a href="#base">base</a></code>, <code>basefont</code>,
-       <code>bgsound</code>, <code><a href="#br">br</a></code>, <code><a
-       href="#col">col</a></code>, <code><a href="#embed">embed</a></code>,
-       <code>frame</code>, <code><a href="#hr">hr</a></code>, <code><a
-       href="#img">img</a></code>, <code>input</code>, <code><a
-       href="#link">link</a></code>, <code><a href="#meta0">meta</a></code>,
-       <code><a href="#param">param</a></code>, <code>spacer</code>, or
-       <code>wbr</code> element, then continue on to the next child node at
-       this point.</p>
-      <!-- also, i guess:
-      image, isindex, and keygen, but we don't list those because we
-      don't consider those "elements", more "macros", and thus we
-      should never serialise them -->
-      <!-- XXX when we get around to
-      it, add event-source -->
-      <p>If the child node is a <code><a href="#pre">pre</a></code> or
-       <code>textarea</code> element, append a U+000A LINE FEED (LF)
-       character.</p>
+        <p>While the exact order of attributes is UA-defined, and may depend
+         on factors such as the order that the attributes were given in the
+         original markup, the sort order must be stable, such that
+         consecutive invocations of this algorithm serialise an element's
+         attributes in the same order.</p>
 
-      <p>Append the value of running the <a href="#html-fragment">HTML
-       fragment serialisation algorithm</a> on the <var title="">child</var>
-       element (thus recursing into this algorithm for that element),
-       followed by a U+003C LESS-THAN SIGN (<code title=""><</code>)
-       character, a U+002F SOLIDUS (<code title="">/</code>) character, the
-       element's tag name again, and finally a U+003E GREATER-THAN SIGN
-       (<code title="">></code>) character.</p>
+        <p>Append a U+003E GREATER-THAN SIGN (<code title="">></code>)
+         character.</p>
 
-     <dt>If the child node is a <code title="">Text</code> or <code
-      title="">CDATASection</code> node
+        <p>If <var title="">current node</var> is an <code><a
+         href="#area">area</a></code>, <code><a href="#base">base</a></code>,
+         <code>basefont</code>, <code>bgsound</code>, <code><a
+         href="#br">br</a></code>, <code><a href="#col">col</a></code>,
+         <code><a href="#embed">embed</a></code>, <code>frame</code>,
+         <code><a href="#hr">hr</a></code>, <code><a
+         href="#img">img</a></code>, <code>input</code>, <code><a
+         href="#link">link</a></code>, <code><a
+         href="#meta0">meta</a></code>, <code><a
+         href="#param">param</a></code>, <code>spacer</code>, or
+         <code>wbr</code> element, then continue on to the next child node at
+         this point.</p>
+        <!-- also, i guess: image, isindex,
+        and keygen, but we don't list those because we don't consider
+        those "elements", more "macros", and thus we should never
+        serialise them -->
+        <!-- XXX when we get around to it, add
+        event-source -->
+        <p>If <var title="">current node</var> is a <code><a
+         href="#pre">pre</a></code> or <code>textarea</code> element, append
+         a U+000A LINE FEED (LF) character.</p>
 
-     <dd>
-      <p>If one of the ancestors of the child node is a <code><a
-       href="#style">style</a></code>, <code><a
-       href="#script0">script</a></code>, <code>xmp</code>, <code><a
-       href="#iframe">iframe</a></code>, <code>noembed</code>,
-       <code>noframes</code>, <code><a href="#noscript">noscript</a></code>,
-       or <code>plaintext</code> element, then append the value of the <var
-       title="">child</var> node's <code title="">data</code> DOM attribute
-       literally.</p>
-      <!-- note about noscript: we're
-      assuming here that scripting is disabled. If this algorithm is
-      used with scripting disabled, this won't work right. -->
-      
-      <p>Otherwise, append the value of the <var title="">child</var> node's
-       <code title="">data</code> DOM attribute, <a href="#escapingString"
-       title="escaping a string">escaped as described below</a>.</p>
+        <p>Append the value of running the <a href="#html-fragment">HTML
+         fragment serialisation algorithm</a> on the <var title="">current
+         node</var> element (thus recursing into this algorithm for that
+         element), followed by a U+003C LESS-THAN SIGN (<code
+         title=""><</code>) character, a U+002F SOLIDUS (<code
+         title="">/</code>) character, the element's tag name again, and
+         finally a U+003E GREATER-THAN SIGN (<code title="">></code>)
+         character.</p>
 
-     <dt>If the child node is a <code title="">Comment</code>
+       <dt>If <var title="">current node</var> is a <code
+        title="">Text</code> or <code title="">CDATASection</code> node
 
-     <dd>
-      <p>Append the literal string <code><!--</code> (U+003C LESS-THAN
-       SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D
-       HYPHEN-MINUS), followed by the value of the <var title="">child</var>
-       node's <code title="">data</code> DOM attribute, followed by the
-       literal string <code>--></code> (U+002D HYPHEN-MINUS, U+002D
-       HYPHEN-MINUS, U+003E GREATER-THAN SIGN).</p>
+       <dd>
+        <p>If one of the ancestors of <var title="">current node</var> is a
+         <code><a href="#style">style</a></code>, <code><a
+         href="#script0">script</a></code>, <code>xmp</code>, <code><a
+         href="#iframe">iframe</a></code>, <code>noembed</code>,
+         <code>noframes</code>, <code><a
+         href="#noscript">noscript</a></code>, or <code>plaintext</code>
+         element, then append the value of <var title="">current node</var>'s
+         <code title="">data</code> DOM attribute literally.</p>
+        <!-- note about noscript: we're
+        assuming here that scripting is disabled. If this algorithm is
+        used with scripting disabled, this won't work right. -->
+        
+        <p>Otherwise, append the value of <var title="">current node</var>'s
+         <code title="">data</code> DOM attribute, <a href="#escapingString"
+         title="escaping a string">escaped as described below</a>.</p>
 
-     <dt>If the child node is a <code title="">DocumentType</code>
+       <dt>If <var title="">current node</var> is a <code
+        title="">Comment</code>
 
-     <dd>
-      <p>Append the literal string <code><!DOCTYPE</code> (U+003C
-       LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+0044 LATIN CAPITAL LETTER
-       D, U+004F LATIN CAPITAL LETTER O, U+0043 LATIN CAPITAL LETTER C,
-       U+0054 LATIN CAPITAL LETTER T, U+0059 LATIN CAPITAL LETTER Y, U+0050
-       LATIN CAPITAL LETTER P, U+0045 LATIN CAPITAL LETTER E), followed by a
-       space (U+0020 SPACE), followed by the value of the <var
-       title="">child</var> node's <code title="">name</code> DOM attribute,
-       followed by the literal string <code>></code> (U+003E GREATER-THAN
-       SIGN).</p>
-    </dl>
+       <dd>
+        <p>Append the literal string <code><!--</code> (U+003C LESS-THAN
+         SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D
+         HYPHEN-MINUS), followed by the value of <var title="">current
+         node</var>'s <code title="">data</code> DOM attribute, followed by
+         the literal string <code>--></code> (U+002D HYPHEN-MINUS, U+002D
+         HYPHEN-MINUS, U+003E GREATER-THAN SIGN).</p>
 
-    <p>Other nodes types (e.g. <code title="">Attr</code>) cannot occur as
-     children of elements. If they do, this algorithm must raise an
-     <code>INVALID_STATE_ERR</code> exception.</p>
+       <dt>If <var title="">current node</var> is a <code
+        title="">DocumentType</code>
 
+       <dd>
+        <p>Append the literal string <code><!DOCTYPE</code> (U+003C
+         LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+0044 LATIN CAPITAL LETTER
+         D, U+004F LATIN CAPITAL LETTER O, U+0043 LATIN CAPITAL LETTER C,
+         U+0054 LATIN CAPITAL LETTER T, U+0059 LATIN CAPITAL LETTER Y, U+0050
+         LATIN CAPITAL LETTER P, U+0045 LATIN CAPITAL LETTER E), followed by
+         a space (U+0020 SPACE), followed by the value of <var
+         title="">current node</var>'s <code title="">name</code> DOM
+         attribute, followed by the literal string <code>></code> (U+003E
+         GREATER-THAN SIGN).</p>
+      </dl>
+
+      <p>Other node types (e.g. <code title="">Attr</code>) cannot occur as
+       children of elements. If, despite this, they somehow do occur, this
+       algorithm must raise an <code>INVALID_STATE_ERR</code> exception.</p>
+    </ol>
+
    <li>
     <p>The result of the algorithm is the string <var title="">s</var>.
   </ol>

Modified: source
===================================================================
--- source	2008-02-29 01:22:51 UTC (rev 1275)
+++ source	2008-02-29 01:56:24 UTC (rev 1276)
@@ -41020,131 +41020,149 @@
 
    <li>
 
-    <p>For each child node <var title="">child</var> of <var
-    title="">the node</var>, in <span>tree order</span>, append the
-    appropriate string from the following list to <var
-    title="">s</var>:</p>
+    <p>For each child node of <var title="">the node</var>, in
+    <span>tree order</span>, run the following steps:
 
-    <dl class="switch">
+    <ol>
 
-     <dt>If the child node is an <code title="">Element</code></dt>
+     <li><p>Let <var title="">current node</var> be the child node
+     being processed.</p></li>
 
-     <dd>
+     <li>
 
-      <p>Append a U+003C LESS-THAN SIGN (<code title=""><</code>)
-      character, followed by the element's tag name. (For nodes
-      created by the <span>HTML parser</span>, <code
-      title="">Document.createElement()</code>, or <code
-      title="">Document.renameNode()</code>, the tag name will be
-      lowercase.)</p>
+      <p>Append the appropriate string from the following list to
+      <var title="">s</var>:</p>
 
-      <p>For each attribute that the element has, append a U+0020
-      SPACE character, the attribute's name (which, for attributes set
-      by the <span>HTML parser</span> or by <code
-      title="">Element.setAttributeNode()</code> or <code
-      title="">Element.setAttribute()</code>, will be lowercase), a
-      U+003D EQUALS SIGN (<code title="">=</code>) character, a U+0022
-      QUOTATION MARK (<code title="">"</code>) character, the
-      attribute's value, <span title="escaping a string">escaped as
-      described below</span>, and a second U+0022 QUOTATION MARK
-      (<code title="">"</code>) character.</p>
+      <dl class="switch">
 
-      <p>While the exact order of attributes is UA-defined, and may
-      depend on factors such as the order that the attributes were
-      given in the original markup, the sort order must be stable,
-      such that consecutive invocations of this algorithm serialise an
-      element's attributes in the same order.</p>
+       <dt>If <var title="">current node</var> is an <code title="">Element</code></dt>
 
-      <p>Append a U+003E GREATER-THAN SIGN (<code title="">></code>)
-      character.</p>
+       <dd>
 
-      <p>If the child node is an <code>area</code>, <code>base</code>,
-      <code>basefont</code>, <code>bgsound</code>, <code>br</code>,
-      <code>col</code>, <code>embed</code>, <code>frame</code>,
-      <code>hr</code>, <code>img</code>, <code>input</code>,
-      <code>link</code>, <code>meta</code>, <code>param</code>,
-      <code>spacer</code>, or <code>wbr</code> element, then continue
-      on to the next child node at this point.</p> <!-- also, i guess:
-      image, isindex, and keygen, but we don't list those because we
-      don't consider those "elements", more "macros", and thus we
-      should never serialise them --> <!-- XXX when we get around to
-      it, add event-source -->
+        <p>Append a U+003C LESS-THAN SIGN (<code title=""><</code>)
+        character, followed by the element's tag name. (For nodes
+        created by the <span>HTML parser</span>, <code
+        title="">Document.createElement()</code>, or <code
+        title="">Document.renameNode()</code>, the tag name will be
+        lowercase.)</p>
 
-      <p>If the child node is a <code>pre</code> or
-      <code>textarea</code> element, append a U+000A LINE FEED (LF)
-      character.</p>
+        <p>For each attribute that the element has, append a U+0020
+        SPACE character, the attribute's name (which, for attributes set
+        by the <span>HTML parser</span> or by <code
+        title="">Element.setAttributeNode()</code> or <code
+        title="">Element.setAttribute()</code>, will be lowercase), a
+        U+003D EQUALS SIGN (<code title="">=</code>) character, a U+0022
+        QUOTATION MARK (<code title="">"</code>) character, the
+        attribute's value, <span title="escaping a string">escaped as
+        described below</span>, and a second U+0022 QUOTATION MARK
+        (<code title="">"</code>) character.</p>
 
-      <p>Append the value of running the <span>HTML fragment
-      serialisation algorithm</span> on the <var title="">child</var>
-      element (thus recursing into this algorithm for that element),
-      followed by a U+003C LESS-THAN SIGN (<code title=""><</code>)
-      character, a U+002F SOLIDUS (<code title="">/</code>) character,
-      the element's tag name again, and finally a U+003E GREATER-THAN
-      SIGN (<code title="">></code>) character.</p>
+        <p>While the exact order of attributes is UA-defined, and may
+        depend on factors such as the order that the attributes were
+        given in the original markup, the sort order must be stable,
+        such that consecutive invocations of this algorithm serialise an
+        element's attributes in the same order.</p>
 
-     </dd>
+        <p>Append a U+003E GREATER-THAN SIGN (<code title="">></code>)
+        character.</p>
 
+        <p>If <var title="">current node</var> is an
+        <code>area</code>, <code>base</code>, <code>basefont</code>,
+        <code>bgsound</code>, <code>br</code>, <code>col</code>,
+        <code>embed</code>, <code>frame</code>, <code>hr</code>,
+        <code>img</code>, <code>input</code>, <code>link</code>,
+        <code>meta</code>, <code>param</code>, <code>spacer</code>, or
+        <code>wbr</code> element, then continue on to the next child
+        node at this point.</p> <!-- also, i guess: image, isindex,
+        and keygen, but we don't list those because we don't consider
+        those "elements", more "macros", and thus we should never
+        serialise them --> <!-- XXX when we get around to it, add
+        event-source -->
 
-     <dt>If the child node is a <code title="">Text</code> or <code
-     title="">CDATASection</code> node</dt>
+        <p>If <var title="">current node</var> is a <code>pre</code>
+        or <code>textarea</code> element, append a U+000A LINE FEED
+        (LF) character.</p>
 
-     <dd>
+        <p>Append the value of running the <span>HTML fragment
+        serialisation algorithm</span> on the <var title="">current
+        node</var> element (thus recursing into this algorithm for
+        that element), followed by a U+003C LESS-THAN SIGN (<code
+        title=""><</code>) character, a U+002F SOLIDUS (<code
+        title="">/</code>) character, the element's tag name again,
+        and finally a U+003E GREATER-THAN SIGN (<code
+        title="">></code>) character.</p>
 
-      <p>If one of the ancestors of the child node is a
-      <code>style</code>, <code>script</code>, <code>xmp</code>,
-      <code>iframe</code>, <code>noembed</code>,
-      <code>noframes</code>, <code>noscript</code>, or
-      <code>plaintext</code> element, then append the value of the
-      <var title="">child</var> node's <code title="">data</code> DOM
-      attribute literally.</p> <!-- note about noscript: we're
-      assuming here that scripting is disabled. If this algorithm is
-      used with scripting disabled, this won't work right. -->
+       </dd>
 
-      <p>Otherwise, append the value of the <var title="">child</var>
-      node's <code title="">data</code> DOM attribute, <span
-      title="escaping a string">escaped as described below</span>.</p>
 
-     </dd>
+       <dt>If <var title="">current node</var> is a <code
+       title="">Text</code> or <code title="">CDATASection</code>
+       node</dt>
 
+       <dd>
 
-     <dt>If the child node is a <code title="">Comment</code></dt>
+        <p>If one of the ancestors of <var title="">current node</var>
+        is a <code>style</code>, <code>script</code>,
+        <code>xmp</code>, <code>iframe</code>, <code>noembed</code>,
+        <code>noframes</code>, <code>noscript</code>, or
+        <code>plaintext</code> element, then append the value of <var
+        title="">current node</var>'s <code title="">data</code> DOM
+        attribute literally.</p> <!-- note about noscript: we're
+        assuming here that scripting is disabled. If this algorithm is
+        used with scripting disabled, this won't work right. -->
 
-     <dd>
+        <p>Otherwise, append the value of <var title="">current
+        node</var>'s <code title="">data</code> DOM attribute, <span
+        title="escaping a string">escaped as described
+        below</span>.</p>
 
-      <p>Append the literal string <code><!--</code> (U+003C
-      LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS,
-      U+002D HYPHEN-MINUS), followed by the value of the <var
-      title="">child</var> node's <code title="">data</code> DOM
-      attribute, followed by the literal string <code>--></code>
-      (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN
-      SIGN).</p>
+       </dd>
 
-     </dd>
 
+       <dt>If <var title="">current node</var> is a <code
+       title="">Comment</code></dt>
 
-     <dt>If the child node is a <code title="">DocumentType</code></dt>
+       <dd>
 
-     <dd>
+        <p>Append the literal string <code><!--</code> (U+003C
+        LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS,
+        U+002D HYPHEN-MINUS), followed by the value of <var
+        title="">current node</var>'s <code title="">data</code> DOM
+        attribute, followed by the literal string <code>--></code>
+        (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN
+        SIGN).</p>
 
-      <p>Append the literal string <code><!DOCTYPE</code> (U+003C
-      LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+0044 LATIN CAPITAL
-      LETTER D, U+004F LATIN CAPITAL LETTER O, U+0043 LATIN CAPITAL
-      LETTER C, U+0054 LATIN CAPITAL LETTER T, U+0059 LATIN CAPITAL
-      LETTER Y, U+0050 LATIN CAPITAL LETTER P, U+0045 LATIN CAPITAL
-      LETTER E), followed by a space (U+0020 SPACE), followed by the
-      value of the <var title="">child</var> node's <code
-      title="">name</code> DOM attribute, followed by the literal
-      string <code>></code> (U+003E GREATER-THAN SIGN).</p>
+       </dd>
 
-     </dd>
 
+       <dt>If <var title="">current node</var> is a <code title="">DocumentType</code></dt>
 
-    </dl>
+       <dd>
 
-    <p>Other nodes types (e.g. <code title="">Attr</code>) cannot
-    occur as children of elements. If they do, this algorithm must
-    raise an <code>INVALID_STATE_ERR</code> exception.</p>
+        <p>Append the literal string <code><!DOCTYPE</code> (U+003C
+        LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+0044 LATIN CAPITAL
+        LETTER D, U+004F LATIN CAPITAL LETTER O, U+0043 LATIN CAPITAL
+        LETTER C, U+0054 LATIN CAPITAL LETTER T, U+0059 LATIN CAPITAL
+        LETTER Y, U+0050 LATIN CAPITAL LETTER P, U+0045 LATIN CAPITAL
+        LETTER E), followed by a space (U+0020 SPACE), followed by the
+        value of <var title="">current node</var>'s <code
+        title="">name</code> DOM attribute, followed by the literal
+        string <code>></code> (U+003E GREATER-THAN SIGN).</p>
 
+       </dd>
+
+
+      </dl>
+
+      <p>Other node types (e.g. <code title="">Attr</code>) cannot
+      occur as children of elements. If, despite this, they somehow do
+      occur, this algorithm must raise an
+      <code>INVALID_STATE_ERR</code> exception.</p>
+
+     </li>
+
+    </ol>
+
    </li>
 
    <li><p>The result of the algorithm is the string <var




More information about the Commit-Watchers mailing list