composed-offset-position

composed-offset-position JS library on GitHub composed-offset-position JS library on npm Download composed-offset-position JS library

This provides a set of ponyfills to achieve the same behavior of `offsetParent`, `offsetLeft` and `offsetTop` before the `offsetParent` spec was changed.

Version 0.0.6 License MIT
composed-offset-position has no homepage
composed-offset-position JS library on GitHub
composed-offset-position JS library on npm
Download composed-offset-position JS library
Keywords
composedoffsetLeftoffsetParentoffsetTopponyfillshadow DOMutils
<script type="module"> import composedOffsetPosition from 'https://cdn.jsdelivr.net/npm/composed-offset-position@0.0.6/+esm' </script>
Learn more

composed-offset-position

This provides a set of ponyfills to achieve the same behavior of offsetParent, offsetLeft and offsetTop before the offsetParent spec was changed.

Installation

Using npm:

$ npm i --save-dev composed-offset-position

Usage

import { offsetLeft, offsetParent, offsetTop } from "composed-offset-position";

console.log(offsetLeft(element));
// ➡️ 0
console.log(offsetTop(element));
// ➡️ 20

console.log(offsetParent(element));
// ➡️ [object HTMLDivElement]

Notes