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?
<div/>
No it isn't legal HTML.
The div element is not described as an EMPTY element in the DTD (4.01).
The definition doesn't have EMPTY:
<!ELEMENT DIV - - (%flow;)*            -- generic language/style container -->
<!ATTLIST DIV
  %attrs;                              -- %coreattrs, %i18n, %events --
  %reserved;                           -- reserved for possible future use --
  >
Contrast with the definition for HR:
<!ELEMENT HR - O EMPTY -- horizontal rule -->
<!ATTLIST HR
  %attrs;                              -- %coreattrs, %i18n, %events --
  >
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With