Escape output

When the output contains HTML special characters, such as '<' and '&', it can be interpreted as HTML, and so displays in an unexpected way. This happened to me as I added debug information to my spec's output. Some of the debug information was swallowed up, because it had those special characters in it. This PR uses the DOM API to escape the spec output in the view.