Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryanve/atts
DOM attributes module
https://github.com/ryanve/atts
attributes dom javascript
Last synced: 13 days ago
JSON representation
DOM attributes module
- Host: GitHub
- URL: https://github.com/ryanve/atts
- Owner: ryanve
- License: other
- Created: 2013-11-05T09:03:18.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2018-01-31T00:54:15.000Z (about 7 years ago)
- Last Synced: 2025-01-20T09:44:57.904Z (16 days ago)
- Topics: attributes, dom, javascript
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/atts
- Size: 46.9 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# atts
#### DOM attributes JavaScript module for [ender](https://github.com/ender-js) or standalone use```sh
npm install atts --save
``````js
var atts = require("atts")
```## API
#### `atts.attr(element, name, value?)`
- Get or set attributes.
- @return string|`undefined`#### `atts.atts(element, object?)`
- `atts.atts(element)` get object containing all attributes
- `atts.atts(element, object)` set attributes via object
- @return object#### `atts.removeAttr(element, names)`
- Remove attributes.
- @return `undefined`#### `atts.toggleAttr(element, name, state?)`
- Toggle an attribute"s presence and return boolean state.
- @return boolean#### `atts.isAttr(element, name)`
- Is attribute `name` present on `element`?
-
@return boolean#### `atts.supportAttr(element, name)`
- Test if `element` supports an attribute.
- @return boolean#### `atts.anyAttr(element, fn?, scope?)`
- Count or iterate element"s attributes.
- @return number### Chain methods
These exist on `atts.prototype` and are designed for integration into jQuery-like libs but can also be used via `atts.prototype[method].call`. Methods are generally compatible with [jQuery methods](http://api.jquery.com/category/manipulation/general-attributes/) of the same name.- `.attr(name, value?)`
- `.atts(object?)`
- `.removeAttr(ssv)`
- `.toggleAttr(name, force?)`