I'd still prefer a template for readability. I don't think a template would be less performant actually, because a template is parsed into a native js function and then just executed.