Interweave utilizes the DOM to parse and validate HTML, and as such, requires a polyfill for server-side rendering to work correctly. There are 2 options to solve this.
Begin by importing and executing the
polyfill() function before rendering React. This requires
Interweave v12.5+ and will intercept the document parser with a custom implementation.
This option is very lightweight and only supports the bare minimum. For example, nodes in the tree only support the
setAttribute()methods (view all available). If you encounter a situation where you need more functionality, please submit a pull request!
JSDOM is a full DOM implementation within Node, and as such, can easily polyfill the document. This approach may be heavy but is the most robust.
Begin by creating an instance and setting the
document globals before rendering