# element-ready-es5

> Detect when an element is ready in the DOM

Latest version **2.1.0** (published 2017-06-20) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install element-ready-es5
pnpm add element-ready-es5
yarn add element-ready-es5
bun add element-ready-es5
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2017-06-20 |
| First published | 2016-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sindre Sorhus |
| Maintainers | bfred-it |
| Keywords | browser, element, ready, el, dom, css, selector, wait, detect, check |

## Links

- npm: https://www.npmjs.com/package/element-ready-es5
- Repository: https://github.com/bfred-it/element-ready-es5
- Homepage: https://github.com/bfred-it/element-ready-es5#readme
- Issues: https://github.com/bfred-it/element-ready-es5/issues
- npm.io page: https://npm.io/package/element-ready-es5

## Dependencies (1)

- [p-cancelable](https://npm.io/package/p-cancelable.md) ^0.2.0

## 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.1.0 (latest) — 2017-06-20
- 0.2.2 — 2016-07-06
- 0.2.1 — 2016-07-05
- 0.2.0 — 2016-07-05

## README

# element-ready-es5 [![Build Status](https://travis-ci.org/bfred-it/element-ready-es5.svg?branch=master)](https://travis-ci.org/bfred-it/element-ready-es5)

> Detect when an element is ready in the DOM

Compatible with browsers like Safari and IE11 (you'll have to polyfill `Promise` in IE11)

=======
>>>>>>> sindresorhus/master

## Install

There is no browser-ready package. You'll need browserify/webpack/rollup.

```
$ npm install --save element-ready-es5
```


## Usage

```js
var elementReady = require('element-ready-es5');

elementReady('#unicorn').then(function (element) {
	console.log(element.id);
	//=> 'unicorn'
});
```


## API

### elementReady(selector)

Returns a promise for a matching element.

#### selector

Type: `string`

[CSS selector.](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)

### elementReadyPromise#cancel()

Type: `Function`

Stops checking for the element to be ready. The cancelation is synchronous.

Calling it after the promise has settled or multiple times does nothing.

Based on [p-cancelable](https://github.com/sindresorhus/p-cancelable).


## Related

- [dom-loaded](https://github.com/sindresorhus/dom-loaded) - Check when the DOM is loaded like `DOMContentLoaded`


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)

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