Find CLS

PHOTO EMBED

Sun Oct 01 2023 18:57:31 GMT+0000 (Coordinated Universal Time)

Saved by @dpavone #javascript

new PerformanceObserver((list) => {
  for (const {value, startTime, sources} of list.getEntries()) {
    // Log the shift amount and other entry info.
    console.log('Layout shift:', {value, startTime});
    if (sources) {
      for (const {node, curRect, prevRect} of sources) {
        // Log the elements that shifted.
        console.log('  Shift source:', node, {curRect, prevRect});
      }
    }
  }
}).observe({type: 'layout-shift', buffered: true});
content_copyCOPY

https://web.dev/debug-performance-in-the-field/