# queryparent

> The missing parent query function.

Latest version **1.2.2** (published 2017-10-03) · GPL-2.0+ license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2017-10-03 |
| First published | 2016-06-14 |
| Weekly downloads | 0 |
| License | GPL-2.0+ |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ryan P.C. McQuen |
| Maintainers | ryanpcmcquen |
| Keywords | query, queryparent, parent |

## Links

- npm: https://www.npmjs.com/package/queryparent
- Repository: https://github.com/ryanpcmcquen/queryparent
- Homepage: https://github.com/ryanpcmcquen/queryparent#readme
- Issues: https://github.com/ryanpcmcquen/queryparent/issues
- npm.io page: https://npm.io/package/queryparent

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2017-10-03
- 1.2.1 — 2016-07-21
- 1.2.0 — 2016-07-09
- 1.1.0 — 2016-06-19
- 1.0.1 — 2016-06-14
- 1.0.0 — 2016-06-14

## README

# queryparent
JavaScript's missing `queryParent` function.

Takes two arguments:

1. A `selector`.
2. A `parentNode` of that selector.

Given element `.bar` with parent element `.foo`, you would do:

```javascript
queryParent('.bar', '.foo');
// => Returns `.foo`.
```

Check out a demo of it here:

https://jsfiddle.net/ryanpcmcquen/zkw0gdj7/

## Why is it better than `.contains()`?

`.contains()` will not work easily in cases where there are multiple similar parent selectors.
For an example of what that means see the above fiddle.

It is available via `npm` for new-school kids (es6):

https://www.npmjs.com/package/queryparent

Or [RawGit](http://rawgit.com/) for old-school kids (es5):

https://cdn.rawgit.com/ryanpcmcquen/queryparent/be73bf37ed9d7138702157bf6f86fe3f04068f33/index-es5.js

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