img-not-child-of-container-timing.html (1457B)
1 <!DOCTYPE HTML> 2 <meta charset=utf-8> 3 <title>Container Timing: observe containertiming attribute with an image that is not its child</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 async_test(function (t) { 16 assert_implements(window.PerformanceContainerTiming, "PerformanceContainerTiming is not implemented"); 17 const observer = new PerformanceObserver( 18 function(entryList) { 19 assert_unreached("No entry is expected with nothing to paint"); 20 } 21 ); 22 observer.observe({entryTypes: ['container']}); 23 24 finishOnElementTiming(t); 25 26 // Add a div that is the container timing root 27 const div = document.createElement('div'); 28 div.setAttribute('containertiming', 'div_ct'); 29 document.body.appendChild(div); 30 31 // Add image of width equal to 100 and height equal to 100. 32 const img = document.createElement('img'); 33 img.src = '/container-timing/resources/square100.png'; 34 img.setAttribute('id', 'img_id'); 35 document.body.appendChild(img); 36 37 addPaintingElementTimingAfterDoubleRAF(document.body); 38 }, 'Containertiming observed without paintable contents and an image outside does not report observations.'); 39 </script> 40 41 </body>