textContent vs innerHTML
innerHTML returns the HTML as its name indicates. Quite often, in order to retrieve or write text within an element, people use innerHTML. textContent should be used instead. Because the text is not parsed as HTML, it's likely to have better performance.
Moreover, this avoids an XSS attack vector! https://developer.mozilla.org/en/docs/Web/API/Node/textContent
Comment
textContent vs innerHTML
innerHTML returns the HTML as its name indicates. Quite often, in order to retrieve or write text within an element, people use innerHTML. textContent should be used instead. Because the text is not parsed as HTML, it's likely to have better performance.
Moreover, this avoids an XSS attack vector!
https://developer.mozilla.org/en/docs/Web/API/Node/textContent
and http://perfectionkills.com/the-poor-misunderstood-innerText/
and http://stackoverflow.com/questions/12286975/when-working-with-text-nodes-should-i-use-the-data-nodevalue-textcontent/12287159#12287159
-> use msg.firstChild.data