Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rbrtsmith/native-dom-helpers
A collection of helper functions for interacting with the native DOM
https://github.com/rbrtsmith/native-dom-helpers
Last synced: 9 days ago
JSON representation
A collection of helper functions for interacting with the native DOM
- Host: GitHub
- URL: https://github.com/rbrtsmith/native-dom-helpers
- Owner: rbrtsmith
- Created: 2015-09-29T06:31:22.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-29T07:46:40.000Z (over 9 years ago)
- Last Synced: 2024-12-06T21:56:08.322Z (28 days ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Native DOM helpers
A collection of helper functions for interacting with the native DOM##hasClass##
Takes a DOM element node and a string. It returns true if the string was found on the className attribute, otherwise returns false.
`hasClass(document.querySelector('#id), 'foo');`##addClass##
Takes a single DOM element, or a collection and a string. It appends the supplied string to the className attribute if not already present on each node in the collection.
`addClass(document.querySelector('#id), 'foo');`
**Dependencies**
* hasClass##removeClass##
Takes a single DOM element or a collection and a string. It removes the supplied string from the className attribute if it exists for each node in the collection.
`removeClass(document.querySelector('#id), 'foo');`
**Dependencies**
* hasClass