# 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.

Latest version **0.0.6** (published 2024-07-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install composed-offset-position
pnpm add composed-offset-position
yarn add composed-offset-position
bun add composed-offset-position
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2024-07-22 |
| First published | 2023-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | jcfranco |
| Maintainers | jcfranco |
| Keywords | composed, offsetLeft, offsetParent, offsetTop, ponyfill, shadow DOM, utils |

## Links

- npm: https://www.npmjs.com/package/composed-offset-position
- Repository: https://github.com/jcfranco/composed-offset-position
- Homepage: https://github.com/jcfranco/composed-offset-position#readme
- Issues: https://github.com/jcfranco/composed-offset-position/issues
- npm.io page: https://npm.io/package/composed-offset-position

## Recent versions

- 0.0.6 (latest) — 2024-07-22
- 0.0.5 — 2024-07-17
- 0.0.4 — 2023-02-27
- 0.0.3 — 2023-02-26
- 0.0.2 — 2023-02-25
- 0.0.1 — 2023-02-25

## README

# `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](https://github.com/w3c/csswg-drafts/issues/159).

## Installation

Using npm:

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

## Usage

```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]
```

## Notes

- Based on <https://github.com/josepharhar/offsetparent-polyfills/> (many thanks to @josepharhar)

---
_Source: https://npm.io/package/composed-offset-position · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
