discourse/discourse — pull request #1851 by vikhyat (2014-01-21 08:23:47+00:00)
Title: Add server-side DOM implementation to fix spoiler tags.

The `Discourse.Dialect.replaceElement` function introduced in 6b9b2d3d6ad0dfc026fbf66d250220eab2c8c8fe depends on the existence of `document.implementation.createHTMLDocument` which isn't present on the server-side, which was causing a 500 error whenever anyone tries to make a post containing the spoiler tags.

This commit is a quick-fix for the issue, I simply added domino.js (https://github.com/fgnass/domino) on the server side to get things running again.

However since that is the only function in that file that (to my knowlege) depends on the existence of `document` it might actually be silly to add 19,510 LOC just for a DOM implementation on the server-side, might be better to rewrite that function to not rely on the DOM.