wpt / css / selectors / selector-required-type-change-002.html

Status: FAIL | Duration: 11ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/selectors/selector-required-type-change-002.html

<!DOCTYPE html>
<html class="reftest-wait">
  <head>
    <title>Check for correctly updating :required matching on type change</title>
    <link rel="match" href="selector-required-type-change-002-ref.html">
    <link rel="help" href="https://drafts.csswg.org/selectors-4/#opt-pseudos">
    <style>
      span { color: red; }
      :required + span { color: green }
    </style>
    <script>
      onload = function() {
        // setTimeout because in some browsers apparently a toplevel restyle
        // happens right after the load event fires?
        setTimeout(function() {
          document.querySelector("input").type = "";
          document.documentElement.className = "";
        }, 10);
      }
    </script>
  </head>
  <body>
    <input type="hidden" required><span>This should be green</span>
  </body>
</html>

/css/selectors/selector-required-type-change-002-ref.html

<!DOCTYPE html>
<html>
  <head>
    <style>
      span { color: green; }
    </style>
  </head>
  <body>
    <input required><span>This should be green</span>
  </body>
</html>