Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE HTML>
<head>
<meta charset=utf-8>
<title>Container Timing: observe a node with a pseudo before text inside a container timing root</title>
<style>
body {
margin: 20px;
}
.has_before_pseudo::before {
content: 'This is text I care about';
font-size: 12px;
}
</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>
async_test(function (t) {
let beforeRender;
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, 'ct', 'hbp_id', beforeRender);
})
);
observer.observe({type: 'container', buffered: true});
beforeRender = performance.now();
}, 'Element with a pseudo before text inside a container timing that is observed.');
</script>
</head>
<body>
<div id="ct_id" containertiming="ct">
<p class="has_before_pseudo" id="hbp_id"></div>
</div>
</body>