# dom-matches

> Check if a DOM element matches a given selector

Latest version **2.0.0** (published 2015-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install dom-matches
pnpm add dom-matches
yarn add dom-matches
bun add dom-matches
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2015-08-18 |
| First published | 2014-08-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/dom-matches) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Nicolas Gallagher |
| Maintainers | necolas |
| Keywords | browser, dom, element, matches, selector |

## Links

- npm: https://www.npmjs.com/package/dom-matches
- Repository: https://github.com/necolas/dom-matches
- Homepage: https://github.com/necolas/dom-matches#readme
- Issues: https://github.com/necolas/dom-matches/issues
- npm.io page: https://npm.io/package/dom-matches

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

- 2.0.0 (latest) — 2015-08-18
- 1.0.1 — 2014-08-20
- 1.0.0 — 2014-08-16

## README

# dom-matches

[![Build Status](https://secure.travis-ci.org/necolas/dom-matches.png?branch=master)](http://travis-ci.org/necolas/dom-matches)

Check if a DOM element matches a given selector.

## Installation

```
npm install dom-matches
```

## API

### matches(elem, selector)

* `elem`: a DOM node.
* `selector`: a CSS selector string.

```js
var matches = require('dom-matches');
var elem = document.querySelector('.foo');

matches(elem, '.foo');
// => true

matches(elem, '.bar');
// => false
```

## Browser support

* Google Chrome
* Firefox ESR+
* Internet Explorer 10+
* Safari 6+
* Opera

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