2.2.54 [HTML] Section 18.2.3, Intrinsic events
The specification states:
HTML documents are constrained to conform to the HTML DTD both before and after processing any SCRIPT elements.
All Document Modes (All Versions)
Rendering of the page will be attempted even if the markup does not conform to the HTML DTD, irrespective of script execution. For example, using script to insert frames in an HTML 4 Strict page is technically invalid, but the frame will be rendered anyway.