<!DOCTYPE html>
<!--  form with one valid element which is made valid dynamically -->
<html>
  <head>
    <style>
      form:invalid {display: none;}
    </style>
  </head>
  <script>
    function onloadHandler()
    {
      document.getElementById('i').value = 'foo';
      document.documentElement.className = '';
    }
  </script>
  <body onload="onloadHandler();">
    <form>
      <input id='i' required>
    </form>
  </body>
</html>