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:
- /container-timing/tentative/containertiming-and-ignore-on-img-itself.html - WPT Dashboard Interop Dashboard
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Container Timing: observe an image with both containertiming and containertiming-ignore</title>
<body>
<style>
body {
margin: 0;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/container-timing/resources/container-timing-helpers.js"></script>
<script>
let beforeRender;
async_test(function (t) {
assert_implements(window.PerformanceContainerTiming, "PerformanceContainerTiming is not implemented");
const observer = new PerformanceObserver(
t.step_func_done(function(entryList) {
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
checkContainerEntry(entry, 'image_ct', 'my_id', beforeRender);
checkContainerIntersectionRect(entry, [0, 100, 0, 100])
checkContainerSize(entry, 10000);
})
);
observer.observe({entryTypes: ['container']});
// Add an image that is itself a container timing root AND has
// containertiming-ignore set. containertiming-ignore only blocks upward
// propagation to ancestor roots; the element's own paint still reports
// under its own root.
const img = document.createElement('img');
img.src = '/container-timing/resources/square100.png';
img.setAttribute('containertiming', 'image_ct');
img.setAttribute('containertiming-ignore', '');
img.setAttribute('id', 'my_id');
document.body.appendChild(img);
beforeRender = performance.now();
}, 'Image with both containertiming and containertiming-ignore reports its own paint.');
</script>
</body>