In HTML, tags and entities aren\'t parsed within tags, and
immediately ends the tag. Thus,
In HTML, as opposite to XHTML, the content of a script
element is processed as plain text except for the occurrence of an end tag, so that ends processing and must, in conforming documents, start the end tag
. There is no general mechanism to avoid this. Any methods that circumvent this feature are unavoidably dependent on the “language” used inside the element. The word “language” is in quotes here, because the content can be just about anything, as long as your code can parse and process it.
So: no general mechanism, but for content other than JavaScript or some of the few other client-side scripting languages recognized by some browsers, you can make your own rules.