use _safe_append for all output

catches js errors appending anything to output,
including javascript in an HTML output.

closes #4095
Merge pull request #4136 from minrk/catch-js

catch javascript errors in any output

not just javascript.

catches js errors appending anything to the output area, such as js in HTML (#4095).

closes #4095