Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryanve/annex
DOM insertion module
https://github.com/ryanve/annex
dom dom-manipulation javascript javascript-library
Last synced: 13 days ago
JSON representation
DOM insertion module
- Host: GitHub
- URL: https://github.com/ryanve/annex
- Owner: ryanve
- Created: 2013-09-25T18:19:37.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-09-05T08:21:13.000Z (over 8 years ago)
- Last Synced: 2025-01-20T09:44:54.401Z (16 days ago)
- Topics: dom, dom-manipulation, javascript, javascript-library
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/annex
- Size: 49.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# annex
DOM insertion module```sh
npm install annex --save
```## API
### `annex()` ⇒ instance
#### `annex(markup|node|stack)````js
annex('home').appendTo(document.body) // annex(markup) example
annex(document.body).append('home') // annex(node) example
annex(document.querySelectorAll('.example')).remove() // annex(stack) example
```### Chain
#### jQuery-compatible [syntax](http://api.jquery.com/category/manipulation/dom-insertion-inside/)
- `.html(string?)` Get or set.
- `.text(string?)` Get or set.
- `.tag()` Get markup string.
- `.tags()` Get markup array.
- `.after(content...)` Insert content.
- `.before(content...)` Insert content.
- `.append(content...)` Insert content.
- `.prepend(content...)` Insert content.
- `.appendTo(target)` Insert into target.
- `.prependTo(target)` Insert into target.
- `.detach()` Detach nodes from DOM for later use.
- `.remove()` Detach nodes from DOM and purge.
- `.empty()` Empty nodes.
- `.clone()` Clone nodes.### Static
#### Fast simple static methods
- `annex.text(node)` Get.
- `annex.html(node)` Get.
- `annex.contents(node)` Get nodes.
- `annex.tag(node)` Get markup string.
- `annex.tags(nodes)` Get markup array.
- `annex.detach(node)` Detach from DOM.
- `annex.empty(node)` Empty node.
- `annex.owner(node)` Get owner document.## Fund
[Fund opensource dev](https://www.gittip.com/ryanve/) =)
## License
[MIT](package.json)