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/nested-containertiming-and-ignore-on-text.html - WPT Dashboard Interop Dashboard
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Container Timing: a paragraph with both containertiming and containertiming-ignore inside an outer containertiming root</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) {
// Only one entry: the inner text root. The outer containertiming
// root must NOT receive the paint because the paragraph carries
// containertiming-ignore which blocks upward propagation.
assert_equals(entryList.getEntries().length, 1,
'one entry expected for the text root, none for the outer root');
const entry = entryList.getEntries()[0];
checkContainerEntry(entry, 'p_ct', 'my_id', beforeRender);
})
);
observer.observe({entryTypes: ['container']});
// Outer containertiming root.
const outer = document.createElement('div');
outer.setAttribute('containertiming', 'outer_ct');
document.body.appendChild(outer);
// Paragraph that is itself a container timing root and has
// containertiming-ignore set. The ignore must prevent the text paint
// from propagating to the outer containertiming root, but the paragraph
// itself must still report its own text paint.
const p = document.createElement('p');
p.setAttribute('containertiming', 'p_ct');
p.setAttribute('containertiming-ignore', '');
p.id = 'my_id';
p.innerText = "This is a text";
outer.appendChild(p);
beforeRender = performance.now();
}, 'Text element with containertiming + containertiming-ignore inside outer containertiming reports under itself only.');
</script>
</body>