Client Side Composing | Create Elements vs. .innerHTML writes | invisible code

好久不见. 提交于 2019-12-12 02:32:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!