This question refers specifically to a script tag. I think it applies also to a div, but I just want to make sure. Is this legal html or not?
No it isn't legal HTML.
The div element is not described as an EMPTY element in the DTD (4.01).
div
EMPTY
The definition doesn't have EMPTY:
Contrast with the definition for HR:
HR