# ancestors

> return a list of all of a DOM nodes parents, optionally filtered

Latest version **0.0.3** (published 2013-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install ancestors
pnpm add ancestors
yarn add ancestors
bun add ancestors
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2013-03-05 |
| First published | 2012-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Chris Dickinson |
| Maintainers | chrisdickinson |
| Keywords | DOM, parentNode, parents, traversal |

## Links

- npm: https://www.npmjs.com/package/ancestors
- Repository: https://github.com/chrisdickinson/ancestors
- npm.io page: https://npm.io/package/ancestors

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2013-03-05
- 0.0.2 — 2013-03-05
- 0.0.1 — 2012-12-29
- 0.0.0 — 2012-12-29

## README

# ancestors

[![browser support](http://ci.testling.com/chrisdickinson/ancestors.png)](http://ci.testling.com/chrisdickinson/ancestors)


return a list of a node's ancestors, optionally filtered with a provided function.

```javascript

var parents = require('ancestors')
  , el = document.getElementById('target')


var p = parents(el)
// [list, of, parent, elements]

var p = parents(el, function(node) { return node.tagName == 'div' })
// [list, of, parent, div, elements] 

``` 

# API

## parents(element[, filterFunction]) -> [list of elements]

# License

MIT

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