As per HTML 4.01, the first occurrence of the character sequence "</" (end-tag open delimiter) is treated as terminating the end of SCRIPT element's content.
This means that something like document.write('<p>foo</p>')
should not work, but something like document.write('<p>foo<'+'/p>')
should.
But which browsers actually respect this? It seems like de-facto standard is "</script" sequence, not just "</". If textarea below is displayed with "test" in it, browser does NOT respect "</" as terminating sequence.