# html-element-size

> Helper function to get size of unvisible HTML element or HTML element not attached to DOM

Latest version **1.1.0** (published 2017-12-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install html-element-size
pnpm add html-element-size
yarn add html-element-size
bun add html-element-size
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-12-14 |
| First published | 2017-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dmitriy Pushkov |
| Maintainers | ezze |
| Keywords | html, dom, element, size |

## Links

- npm: https://www.npmjs.com/package/html-element-size
- Repository: https://github.com/ezze/html-element-size
- Homepage: https://github.com/ezze/html-element-size#readme
- Issues: https://github.com/ezze/html-element-size/issues
- npm.io page: https://npm.io/package/html-element-size

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-12-14
- 1.0.0 — 2017-11-27

## README

# html-element-size

[![npm](https://img.shields.io/npm/v/html-element-size.svg)](https://www.npmjs.com/package/html-element-size)
[![Build Status](https://travis-ci.org/ezze/html-element-size.svg?branch=develop)](https://travis-ci.org/ezze/html-element-size)
[![Coverage Status](https://coveralls.io/repos/github/ezze/html-element-size/badge.svg?branch=develop)](https://coveralls.io/github/ezze/html-element-size?branch=develop)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE)

Helper function to get size of unvisible HTML element or HTML element not attached to DOM.

## Installation

```
npm install html-element-size
```
    
## Usage

- ES6:

   ```javascript
   import htmlElementSize from 'html-element-size';
   const size = htmlElementSize(document.querySelector('.my-element'), {
       removeClass: 'my-element-hidden',
       addClass: 'my-element-some-class'
   });
   console.log(size); // => { width: 200; height: 100 }
   ```
   
- Common.js: 

   ```javascript
   var htmlElementSize = require('html-element-size');
   var size = htmlElementSize(document.querySelector('.my-element'), {
       removeClass: 'my-element-hidden',
       addClass: 'my-element-some-class'
   });
   ```

- Browser (include `dist/html-element-size.js` or `dist/html-element-size.min.js`):

   ```javascript
   var htmlElementSize = window.htmlElementSize;
   var size = htmlElementSize(document.querySelector('.my-element'), {
       removeClass: 'my-element-hidden',
       addClass: 'my-element-some-class'
   });
   console.log(size); // => { width: 200; height: 100 }
   ```

## Building

In order to build library run:

```
npm run build
```
    
## Testing
    
Run tests:
    
    npm test
   
Run tests with coverage:

    npm run test:coverage
    
## Contributing
    
Before making a pull request, please, be sure that you start from `develop` branch.

## License

[MIT](LICENSE)

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