| <!DOCTYPE HTML> |
| <meta charset=utf-8> |
| <title>Container Timing: observe with a node with containertiming and a text child</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, 'div_ct', 'p_id', beforeRender) |
| }) |
| ); |
| observer.observe({entryTypes: ['container']}); |
| // Add the text during onload to be sure that the observer is registered |
| // in time. |
| window.onload = () => { |
| // Add a div that is the container timing root |
| const div = document.createElement('div'); |
| div.setAttribute('containertiming', 'div_ct'); |
| document.body.appendChild(div); |
| |
| const p = document.createElement('p'); |
| p.id = 'p_id'; |
| p.innerText = "This is a text"; |
| div.appendChild(p); |
| beforeRender = performance.now(); |
| }; |
| }, 'Paint of the text child of container timing is reported.'); |
| </script> |
| |
| </body> |