Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-overflow/scroll-markers/scroll-marker-group-body-overflow-propagation-003-crash.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Overflow Test: Inserting and removing a body before the body, which changes whether its overflow propagates to the viewport, does not crash</title>
<style>
html {
scroll-marker-group: before;
}
body {
scroll-marker-group: before;
overflow: auto;
}
#item::scroll-marker {
content: "";
}
</style>
<div id="item"></div>
<script>
const html = document.documentElement;
html.offsetTop;
// The overflow of the inserted body propagates to the viewport instead, which
// moves #item's ::scroll-marker from the root's group to its body's group.
const first_body = document.createElement("body");
html.insertBefore(first_body, document.body);
html.offsetTop;
first_body.remove();
</script>