Client Side Composing | Create Elements vs. .innerHTML writes | invisible code
-
28-10-2019 - |
Question
Which is better?
Is there a way to keep content out of the view->source()?
Solution
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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow