containertiming-text-itself.html (1253B)
1 <!DOCTYPE HTML> 2 <meta charset=utf-8> 3 <title>Container Timing: observe a paragraph with containertiming attribute</title> 4 <body> 5 <style> 6 body { 7 margin: 0; 8 } 9 </style> 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 <script src="/container-timing/resources/container-timing-helpers.js"></script> 13 <script src="/element-timing/resources/element-timing-helpers.js"></script> 14 <script> 15 let beforeRender; 16 async_test(function (t) { 17 assert_implements(window.PerformanceContainerTiming, "PerformanceContainerTiming is not implemented"); 18 const observer = new PerformanceObserver( 19 t.step_func_done(function(entryList) { 20 assert_equals(entryList.getEntries().length, 1); 21 const entry = entryList.getEntries()[0]; 22 checkContainerEntry(entry, 'p_ct', 'my_id', beforeRender); 23 }) 24 ); 25 observer.observe({entryTypes: ['container']}); 26 27 const p = document.createElement('p'); 28 p.setAttribute('containertiming', 'p_ct'); 29 p.id = 'my_id'; 30 p.innerText = "This is a text"; 31 document.body.appendChild(p); 32 33 beforeRender = performance.now(); 34 }, 'Element with containertiming attribute is observable and reports the text paint.'); 35 </script> 36 37 </body>