This provides a set of ponyfills to achieve the same behavior of `offsetParent`, `offsetLeft` and `offsetTop` before the `offsetParent` spec was changed.
npm install composed-offset-positioncomposed-offset-positionThis provides a set of ponyfills to achieve the same behavior of offsetParent, offsetLeft and offsetTop before the offsetParent spec was changed.
Using npm:
``npm`
$ npm i --save-dev composed-offset-position
`js
import { offsetLeft, offsetParent, offsetTop } from "composed-offset-position";
console.log(offsetLeft(element));
// ➡️ 0
console.log(offsetTop(element));
// ➡️ 20
console.log(offsetParent(element));
// ➡️ [object HTMLDivElement]
``
- Based on