Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /dom/nodes/moveBefore/tentative/preserve-render-blocking-style.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<head>
<title>Stylesheet with "blocking=render" should remain render-blocking when moved</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
const link = document.createElement("link");
link.rel = "stylesheet";
link.href = "resources/green.css?pipe=trickle(d1)";
link.setAttribute("blocking", "render");
document.head.append(link);
requestAnimationFrame(() => {
window.backgroundColorAtFirstRender = getComputedStyle(document.body).backgroundColor;
});
</script>
</head>
<body>
<div>Some text</div>
<script>
document.head.moveBefore(link, null);
</script>
<script>
promise_test(async () => {
await new Promise(resolve => requestAnimationFrame(() => resolve()));
assert_equals(backgroundColorAtFirstRender, "rgb(0, 128, 0)");
}, "A moved script should keep its render-blocking state");
</script>
</body>