问题
Which is better?
Is there a way to keep content out of the view->source()?
回答1:
I think what they objected to was the use off innerHTML. Some would say that constructing and adding nodes (http://www.w3schools.com/dom/dom_nodes_add.asp) would be the more refined way to do this and you should at least look at it as an option. If it's too much work, I say just go with innerHTML. It's supported by pretty much any browser anyway. (http://www.quirksmode.org/dom/w3c_html.html)
来源:https://stackoverflow.com/questions/9379789/client-side-composing-create-elements-vs-innerhtml-writes-invisible-code