客户端组成|创建元素与.innerHTML写入|隐形代码 [英] Client Side Composing | Create Elements vs. .innerHTML writes | invisible code
问题描述
哪个更好?
有没有一种方法可以将内容保留在view-> source()?
我认为他们反对的是使用innerHTML。有人会说,构建和添加节点( http://www.w3schools.com/dom/dom_nodes_add。 asp )将是更精确的方式来做到这一点,你至少应该把它看作一个选项。如果工作量太大,我只能说用innerHTML。无论如何,它几乎支持任何浏览器。 ( http://www.quirksmode.org/dom/w3c_html.html ) p>
Which is better?
Is there a way to keep content out of the view->source()?
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)
这篇关于客户端组成|创建元素与.innerHTML写入|隐形代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!