1
0
Fork 0
firefox/testing/web-platform/tests/container-timing/tentative/containertiming-text-itself.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

39 lines
1.4 KiB
HTML

<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Container Timing: observe a paragraph with containertiming attribute</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 src="/element-timing/resources/element-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, 'p_ct', 'my_id', beforeRender);
})
);
observer.observe({entryTypes: ['container']});
// Add the text during onload to be sure that the observer is registered
// in time.
window.onload = () => {
const p = document.createElement('p');
p.setAttribute('containertiming', 'p_ct');
p.id = 'my_id';
p.innerText = "This is a text";
document.body.appendChild(p);
beforeRender = performance.now();
};
}, 'Element with containertiming attribute is observable and reports the text paint.');
</script>
</body>