https://github.com/code-soup/dom-js
Frequent DOM Js functions
https://github.com/code-soup/dom-js
Last synced: 8 months ago
JSON representation
Frequent DOM Js functions
- Host: GitHub
- URL: https://github.com/code-soup/dom-js
- Owner: code-soup
- Created: 2022-04-02T10:56:22.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-02T11:58:25.000Z (about 4 years ago)
- Last Synced: 2024-10-29T10:45:00.158Z (over 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# DOM Js
Collection of small frequently used Js functions for DOM elements manipulation across projects. Nothing fancy, just simple stuff. Simply for writing less code.
## Issues
Please use [Github issues](https://github.com/code-soup/dom-js/issues) to submit any bugs you may find.
## Documentation
@import dom from '@bobz/dom-js';
Wrapper of document.querySelector();
dom.get('.selector');
dom.getAll('.selector'); // instead of document.querySelectorAll();
Un/Set class on node
dom.addClass(node, className);
dom.removeClass(node, className);
Un/Set class on node via selector
dom.setClass(selector, className);
dom.unsetClass(selector, className);
Get Bounding rect
dom.getRect(selector)
Get dataset attribute
dom.getData(node, attr);
#### License
This project is licensed under the [GPL license](http://www.gnu.org/licenses/gpl-3.0.txt).