wpt / css / selectors / media / media-loading-state.sub.html

Status: FAIL | Duration: 46ms | Subtests: 0/3 | Open test on wpt.live | wpt.fyi

Data from commit:
1884860 Copy-on-write style attribute blocks that are in the rule tree (#831) (2026-09-02)

SubtestStatusMessage
Test :pseudo-class syntax is supported without throwing a SyntaxErrorFAILassert_unreached: :buffering is not supported Reached unreachable code
Test :stalled pseudo-classFAILassert_implements: :stalled is not supported undefined
Test :buffering pseudo-classFAILassert_implements: :buffering is not supported undefined

/css/selectors/media/media-loading-state.sub.html

<!DOCTYPE html>
<meta name="timeout" content="long" />
<title>Media Loading State: the :buffering and :stalled pseudo-classes</title>
<link
  rel="help"
  href="https://drafts.csswg.org/selectors/#media-loading-state"
/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
  <video width="300" height="300" muted loop controls></video>
  <script type="module">
    test((t) => {
      for (const pseudo of [":buffering", ":stalled"]) {
        try {
          document.querySelector(`.not-a-thing${pseudo}`);
        } catch (e) {
          assert_unreached(`${pseudo} is not supported`);
        }
      }
    }, "Test :pseudo-class syntax is supported without throwing a SyntaxError");

    promise_test(async (t) => {
      assert_implements(CSS.supports("selector(:stalled)"), ":stalled is not supported");
      const key = "{{uuid()}}";
      const video = document.querySelector("video");
      await new Promise((r) => {
        video.addEventListener("stalled", r, { once: true });
        video.src = `support/stall-resume.py?key=${key}`;
      });
      const promise = video.play();
      assert_true(video.matches(":stalled"), ":stalled matches");
      video.src = "";
      assert_false(video.matches(":stalled"), ":stalled stops matching");
      // Wait for the video to abort trying to play
      try {
        await promise;
      } catch (err) {}
    }, "Test :stalled pseudo-class");

    promise_test(async (t) => {
      assert_implements(CSS.supports("selector(:buffering)"), ":buffering is not supported");
      const key = "{{uuid()}}";
      const video = document.querySelector("video");
      await new Promise((r) => {
        video.addEventListener("stalled", r, { once: true });
        video.src = `support/stall-resume.py?key=${key}`;
      });
      video.currentTime = 10;
      const promise = video.play();
      assert_true(video.matches(":buffering"), ":buffering matches");
      video.src = "";
      assert_false(video.matches(":buffering"), ":buffering stops matching");
      // Wait for the video to abort trying to play
      try {
        await promise;
      } catch (err) {}
    }, "Test :buffering pseudo-class");
  </script>
</body>