Earlier quoted context omitted.
> You don't make an app/website secure by deciding on a list of things you need to sanitise. I agree > You sanitise everything to start with. So you need to list everything you need to sanitise... A better approach is to ban "innerHTML" from your code. You should always display user generated text in text nodes.
Just to clarify: var t = document.createTextNode(msg); content.appendChild(t); That code sanitises all possible content in msg. I don't need to list out HTML tags, script/style tags, do special case for unicode exploits, etc. You need to list what variables are "unsafe", but you don't need to list out the ways they might be unsafe. If it's got the potential to be unsafe, assume it's completely unsafe in every conceiv…
While it's still the fastest method for changing the page DOM it shouldn't be. When used outside of user inputted scenarios it's fine.