+1 vote
by
TextContent safe in contrast to innerHTML?
by
textContent inserts text, and thus exclude the possibility of xss
Don't know how to relate with security. If you need to insert html markup, without innerHTML, you still will not do.
jsfiddle.net/nag4frsu

1 Answer

0 votes
by
Yes, it is faster and protects from xss attacks. Here reference from MDN.
...