https://github.com/aruntk/html5-utils
html5 utils
https://github.com/aruntk/html5-utils
html5 html5-utils parse5
Last synced: 3 months ago
JSON representation
html5 utils
- Host: GitHub
- URL: https://github.com/aruntk/html5-utils
- Owner: aruntk
- Created: 2017-01-16T07:48:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-25T12:46:06.000Z (over 8 years ago)
- Last Synced: 2025-02-20T08:45:02.091Z (4 months ago)
- Topics: html5, html5-utils, parse5
- Language: JavaScript
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTML5-UTILS
helper functions to parse and manipulate html5
[](https://gitter.im/aruntk/projects?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://www.npmjs.com/package/html5-utils)## Attribute Helpers
### getAttrIndex
```js
.getAttrIndex(node, attributeName)
```
first index of the attribute inside attr array or -1 if attribute is not set### hasAttr
```js
.hasAttr(node, attributeName)
```
check if attribute is set### getAttr
```js
.getAttr(node, attributeName)
```
returns attribute value or null### setAttr
```js
.setAttr(node, attributeName, value)
```
sets/changes attribute.### removeAttr
```js
.removeAttr(node, attributeName)
```## TODO
- Create nodes, fragments, comments and shadows
- Append, prepend, replace, remove, swap operations
- Query Selector for nodes. Optional Jquery operations also. like cheerio
- Operations like innerText and innerHTML.
- Extract contents of link nodes and create curresponsing tags
- Change tags
- Ancestors and children helpers
- Cleaners and minifiers
- Change value of desired attribute/s