Support templates that return DOM nodes. Closes #742.