wpt / html / dom / render-blocking / element-render-blocking-insert-named-anchor.html?cached

Open test on wpt.live | wpt.fyi

Runs: Chrome 160.0.8195.0 (wpt@1ab8957e4, 2026-12-01) | Firefox 163.0a1 (wpt@1ab8957e4, 2026-12-01) | Safari 257 preview (wpt@1ab8957e4, 2026-12-01) | Ladybird 1.0-e8319 (wpt@d7c0a00b7, 2026-12-02) | Servo Servo 0.8 (wpt@75c11f957, 2026-12-01) | Blitz af350c0af (wpt@705f393a6, 2026-12-02)

ChromeFirefoxSafariLadybirdServoBlitz
Total1/11/11/10/10/1NOT RUN
SubtestChromeFirefoxSafariLadybirdServoBlitz
Inserting a named anchor satisfies rel=expect with cached getElementsByName resultsPASSPASSPASSFAILFAIL—

/html/dom/render-blocking/element-render-blocking-insert-named-anchor.html

<!DOCTYPE html>
<meta name="timeout" content="long">
<meta name="variant" content="?uncached">
<meta name="variant" content="?cached">
<title>rel=expect finds an inserted named anchor with a cached name collection</title>
<link rel="help" href="https://html.spec.whatwg.org/#process-internal-resource-link">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/utils.js"></script>
<link rel="expect" href="#target" blocking="render">
<script>
let targetInserted = false;
let parsingFinished = false;
let targets;
const t = async_test("Inserting a named anchor satisfies rel=expect with " +
                     location.search.slice(1) + " getElementsByName results");
requestAnimationFrame(t.step_func_done(() => {
  assert_true(targetInserted, "Rendering waits for the target");
  assert_false(parsingFinished,
               "Inserting the named anchor unblocks rendering");
}));
</script>
<body>
<script>
generateParserDelay();
</script>
<script>
t.step(() => {
  if (location.search === "?cached") {
    targets = document.getElementsByName("target");
    assert_equals(targets.length, 0, "Populate the cached collection before insertion");
  }
  const anchor = document.createElement("a");
  anchor.name = "target";
  document.body.append(anchor);
  targetInserted = true;
});
generateParserDelay();
</script>
<script>
parsingFinished = true;
</script>