MDN self-hosted library · e01.org

LayoutShiftAttribution: currentRect property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
new PerformanceObserver((list) => {
  for (const { sources } of list.getEntries()) {
    if (sources && sources.length > 0) {
      console.log(sources[0].currentRect);
    }
  }
}).observe({ type: "layout-shift", buffered: true });