What exactly do I have to escape inside a `script` element?
问题 What parts of JavaScript code do I have to escape inside a script element in a HTML page? Is <>& enough or too much? [EDIT] This is related to this bug: http://code.google.com/p/rendersnake/issues/detail?id=15#c6 comment #6 回答1: In HTML (and XHTML if you're an evil person that sends your XHTML pages as text/html ), script tags are #CDATA , and therefore, the only thing that you shouldn't have in the content is </script> , as that is all that the parser looks for to signal the end of the tag.