LayoutShiftAttribution: currentRect-Eigenschaft
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimentell: Dies ist eine experimentelle Technologie
Überprüfen Sie die Browser-Kompatibilitätstabelle sorgfältig vor der Verwendung auf produktiven Webseiten.
Die schreibgeschützte Eigenschaft currentRect
der Schnittstelle LayoutShiftAttribution
gibt ein DOMRectReadOnly
-Objekt zurück, das die Position des Elements nach der Verschiebung darstellt.
Wert
Ein DOMRectReadOnly
-Objekt.
Beispiele
Das folgende Beispiel gibt die currentRect
des ersten Elements in LayoutShift.sources
in der Konsole aus.
new PerformanceObserver((list) => {
for (const { sources } of list.getEntries()) {
if (sources) {
console.log(sources[0].currentRect);
}
}
}).observe({ type: "layout-shift", buffered: true });
Spezifikationen
Specification |
---|
Layout Instability API # dom-layoutshiftattribution-currentrect |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
currentRect |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.