Skip to content

Commit ff7b32d

Browse files
Fix document serialization (#13)
* Remove the special step to serialize the DocumentType node before looping through the children. (Would cause double-serialization of the DocumentType node.)
1 parent 7e30b8d commit ff7b32d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

index.html

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,17 +1155,15 @@ <h2>Extensibility</h2>
11551155
<ol>
11561156
<li>Let <var>serialized document</var> be an empty string.
11571157

1158-
<li>If <var>node</var>'s <code><a>doctype</a></code> attribute is not <code>null</code>, append
1159-
to <var>serialized document</var> the string produced by running the steps for
1160-
<a>XML serializing a DocumentType node</a> given <var>node</var>'s <code><a>doctype</a></code>
1161-
attribute.
1162-
11631158
<li>For each <a>child</a> <var>child</var> of <var>node</var>, in <a>tree order</a>, run the
1164-
<a>XML serialization algorithm</a> on the <var>child</var> given a <a>context namespace</a>
1165-
<var>namespace</var>, a <a>namespace prefix map</a> <var>prefix map</var>, a reference to a
1166-
<a>generated namespace prefix index</a> <var>prefix index</var>, flag
1167-
<var>require well-formed</var>, and append the result to <var>serialized document</var>.
1168-
1159+
<a>XML serialization algorithm</a> on the <var>child</var> passing along the provided arguments,
1160+
and append the result to <var>serialized document</var>.
1161+
1162+
<p class=note>This will serialize any number of <a>ProcessingInstruction</a> and <a>Comment</a>
1163+
nodes both before and after the <a>Document</a>'s <a>documentElement</a> node, including
1164+
at most one <a>DocumentType</a> node. (<a>Text</a> nodes are not allowed as children of the
1165+
<a>Document</a>.)</p>
1166+
11691167
<li>Return the value of <var>serialized document</var>.
11701168
</ol>
11711169

0 commit comments

Comments
 (0)