You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Using with [JSDOM](https://github.com/jsdom/jsdom)
59
59
60
-
Currently, JSDOM has not implemented the `XMLSerializer` interface. This can be easily integrated with JSDOM and any other similar mockup environment or for web scrapping and xml feed parsing like below.
60
+
Currently[at the time of creating this], JSDOM has not implemented the `XMLSerializer` interface. This can be easily integrated with JSDOM and any other similar mockup environment or for web scrapping and xml feed parsing like below.
61
61
62
62
```javascript
63
63
//assumes jsdom has been installed.
64
64
importXMLSerializerfrom'@teclone/xml-serializer';
65
65
import { JSDOM } from'jsdom';
66
66
67
-
let dom =newJSDOM();
68
-
dom.window.XMLSerializer=XMLSerializer;
67
+
constdom=newJSDOM();
68
+
XMLSerializer.installTo(dom.window);
69
+
69
70
global.window=dom.window;
70
71
71
72
//start running your tests or do something else.
72
73
```
73
74
74
75
### Using on the browser
75
76
76
-
The browser build is available inside the `dist` folder when you npm install the package. You can also this repo and run the build command locally. It exposes an `XMLSerializer` construct on the `window` object.
77
+
The browser build is available inside the `build/dist` folder when you npm install the package. You can also clone this repo and run the build command locally. It exposes an `XMLSerializer` construct on the `window` object.
@@ -93,7 +94,7 @@ By default, the serializer preserves white space during the serialization proces
93
94
94
95
```javascript
95
96
//do not preserve white space
96
-
let instance =newXMLSerializer(false);
97
+
constinstance=newXMLSerializer(false);
97
98
```
98
99
99
100
Another improvement is that it removes all duplicate xml prefix definition on as recommended in the specification document unlike what web browsers do. Below is an example of
0 commit comments