Bug 1634779 - pt 2. Partially revert Bug 1603006 r=kmag
[gecko.git] / dom / webidl / XMLSerializer.webidl
blob0e7e7655c22988269d609ffb3815b6f9662e21a7
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3  * You can obtain one at http://mozilla.org/MPL/2.0/.
4  *
5  * The origin of this IDL file is
6  * http://domparsing.spec.whatwg.org/#the-xmlserializer-interface
7  */
9 interface OutputStream;
11 [Exposed=Window]
12 interface XMLSerializer {
13   constructor();
15   /**
16    * The subtree rooted by the specified element is serialized to
17    * a string.
18    *
19    * @param root The root of the subtree to be serialized. This could
20    *             be any node, including a Document.
21    * @returns The serialized subtree in the form of a Unicode string
22    */
23   [Throws]
24   DOMString serializeToString(Node root);
26   // Mozilla-specific stuff
27   /**
28    * The subtree rooted by the specified element is serialized to
29    * a byte stream using the character set specified.
30    * @param root The root of the subtree to be serialized. This could
31    *             be any node, including a Document.
32    * @param stream The byte stream to which the subtree is serialized.
33    * @param charset The name of the character set to use for the encoding
34    *                to a byte stream.  If this string is empty and root is
35    *                a document, the document's character set will be used.
36    */
37   [Throws, ChromeOnly]
38   void serializeToStream(Node root, OutputStream stream, DOMString? charset);