Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-sizing/responsive-iframe/responsive-iframe-dom-content-loaded.tentative.html - WPT Dashboard Interop Dashboard
<!doctype HTML>
<title>Test that `DOMContentLoaded` triggers resizing.</title>
<link rel="author" href="mailto:kojii@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
iframe {
contain-intrinsic-size: from-element;
}
</style>
<iframe id="target" frameborder=0 src="resources/iframe-contents-dom-content-loaded.html"></iframe>
<script>
async_test(t => {
window.addEventListener('message', t.step_func(e => {
const type = e.data.type;
if (type === 'DOMContentLoaded') {
// The resize may not be synchronous, so wait for an animation frame.
requestAnimationFrame(t.step_func(() => {
assert_equals(target.offsetHeight, 200);
}));
} else if (type === 'load') {
requestAnimationFrame(t.step_func(() => {
assert_equals(target.offsetHeight, 400);
t.done();
}));
}
}));
}, "`DOMContentLoaded` triggers resizing");
</script>
</body>