Add a missing check in step 6 of HTML5 legacy parsing.