11import Serializer from './modules/Serializer.js' ;
22
3- export default class XMLSerializer {
4- /**
5- *@param {boolean } [preserveWhiteSpace=true] - boolean value indicating if white spaces
6- * should be preserved as it is in the source
7- */
8- constructor ( preserveWhiteSpace ) {
9- this . serializer = new Serializer ( preserveWhiteSpace ) ;
10- }
3+ export class XMLSerializer {
4+ /**
5+ *@param {boolean } [preserveWhiteSpace=true] - boolean value indicating if white spaces
6+ * should be preserved as it is in the source
7+ */
8+ constructor ( preserveWhiteSpace ) {
9+ this . serializer = new Serializer ( preserveWhiteSpace ) ;
10+ }
1111
12- /**
13- * return XMLSerializer as modules name
14- */
15- get [ Symbol . toStringTag ] ( ) {
16- return 'XMLSerializer' ;
17- }
12+ /**
13+ * return XMLSerializer as modules name
14+ */
15+ get [ Symbol . toStringTag ] ( ) {
16+ return 'XMLSerializer' ;
17+ }
1818
19- /**
20- * produces an XML serialization of root passing a value of false for the
21- * require well-formed parameter, and return the result.
22- *@param {Node } root - the root node
23- *@param {boolean } [requireWellFormed=false] - boolean value indicating if it should require xml
24- * well formedness
25- *@returns {string }
26- */
27- serializeToString ( root , requireWellFormed ) {
28- return this . serializer . serializeToString ( root , requireWellFormed ) ;
29- }
30- }
19+ /**
20+ * produces an XML serialization of root passing a value of false for the
21+ * require well-formed parameter, and return the result.
22+ *@param {Node } root - the root node
23+ *@param {boolean } [requireWellFormed=false] - boolean value indicating if it should require xml
24+ * well formedness
25+ *@returns {string }
26+ */
27+ serializeToString ( root , requireWellFormed ) {
28+ return this . serializer . serializeToString ( root , requireWellFormed ) ;
29+ }
30+ }
31+
32+ /**
33+ * installs the serialize to the given target object
34+ */
35+ XMLSerializer . install = target => {
36+ target . XMLSerializer = XMLSerializer ;
37+ } ;
0 commit comments