Skip to content

Commit ff73ffc

Browse files
committed
Upstream XMLSerializer from DOM Parsing spec
1 parent 4f44f70 commit ff73ffc

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

source

+48
Original file line numberDiff line numberDiff line change
@@ -116300,6 +116300,54 @@ enum <dfn enum>DOMParserSupportedType</dfn> {
116300116300

116301116301
</div>
116302116302

116303+
<h4>The <code>XMLSerializer</code> interface</h4>
116304+
116305+
<p class="XXX">The <code>XMLSerializer</code> interface has a number of outstanding issues in the
116306+
<cite>DOM Parsing and Serialization</cite> <a
116307+
href="https://github.com/w3c/DOM-Parsing/issues">issue tracker</a>, documenting various problems
116308+
with its specification.</p>
116309+
116310+
<dl class="domintro">
116311+
<dt><code data-x=""><var>xmlSerializer</var> = new <span subdfn data-x="dom-XMLSerializer-constructor">XMLSerializer</span>()</code></dt>
116312+
<dd><p>Constructs a new <code>XMLSerializer</code> object.</p></dd>
116313+
116314+
<dt><code data-x=""><var>string</var> = <var>xmlSerializer</var>.<span subdfn data-x="dom-XMLSerializer-serializeToString">serializeToString</span>(<var>root</var>)</code></dt>
116315+
<dd>
116316+
<p>Returns the result of serializing <var>root</var> to XML.</p>
116317+
116318+
<p>Throws an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code> if
116319+
<var>root</var> cannot be serialized to XML.</p>
116320+
</dd>
116321+
</dl>
116322+
116323+
<p class="note">The design of <code>XMLSerializer</code>, as a class that needs to be constructed
116324+
and then have its <code data-x="dom-XMLSerializer-serializeToString">serializeToString()</code>
116325+
method called, is an unfortunate historical artifact. If we were designing this functionality
116326+
today it would be a standalone function.</p>
116327+
116328+
<pre><code class="idl">[Exposed=Window]
116329+
interface <dfn interface>XMLSerializer</dfn> {
116330+
<span data-x="dom-XMLSerializer-constructor">constructor</span>();
116331+
116332+
DOMString <span data-x="dom-XMLSerializer-serializeToString">serializeToString</span>(<code>Node</code> root);
116333+
};</code></pre>
116334+
116335+
<div w-nodev>
116336+
116337+
<p>The <dfn data-x="dom-XMLSerializer-constructor"><code>new XMLSerializer()</code></dfn>
116338+
constructor steps are to do nothing.</p>
116339+
116340+
<p>The <dfn method for="XMLSerializer"
116341+
data-x="dom-XMLSerializer-serializeToString"><code>serializeToString(<var>root</var>)</code></dfn>
116342+
method steps are:</p>
116343+
116344+
<ol>
116345+
<li><p>Return the <span data-x="xml-serialization">XML serialization</span> of <var>root</var>
116346+
given <var>false</var>.</p></li>
116347+
</ol>
116348+
116349+
</div>
116350+
116303116351
<h3 split-filename="timers-and-user-prompts" id="timers">Timers</h3>
116304116352

116305116353
<p>The <code data-x="dom-setTimeout">setTimeout()</code> and <code

0 commit comments

Comments
 (0)