LayoutShiftAttribution: currentRect property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("Performance API")}}{{SeeCompatTable}}
The **currentRect** read-only property of the {{domxref("LayoutShiftAttribution")}} interface returns a {{domxref("DOMRectReadOnly")}} object representing the position of the element after the shift.
Value
A {{domxref("DOMRectReadOnly")}} object.
Examples
The following example prints the currentRect of the first item in {{domxref("LayoutShift.sources")}} to the console.
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 });Specifications
{{Specifications}}
Browser compatibility
{{Compat}}