html-element-size
v1.1.0
Published
Helper function to get size of unvisible HTML element or HTML element not attached to DOM
Downloads
7
Readme
html-element-size
Helper function to get size of unvisible HTML element or HTML element not attached to DOM.
Installation
npm install html-element-size
Usage
ES6:
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:
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
ordist/html-element-size.min.js
):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.