An open API service indexing awesome lists of open source software.

https://github.com/eldoy/brsrkr


https://github.com/eldoy/brsrkr

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# BRSRKR
Tiny Javascript HTML and DOM manipulation library, encapsulation style.

### Install
`npm i brsrkr`

### Usage
```javascript
// Get HTML
$('#app').html()

// Insert HTML
$('#app').html('

Before
')

// Insert HTML before element
$('#app').html('

hello
', 'before')

// Insert HTML after element
$('#app').html('

hello
', 'after')

// Insert HTML at top of element
$('#app').html('

hello
', 'top')

// Insert HTML at end of element
$('#app').html('

hello
', 'end')

// Get text
$('#app').text()

// Insert text
$('#app').text('hello')

// Query DOM, uses callback
$('#app', el => el.textContent = 'hello')

// Function body applies to all matches
$('li', el => {
el.style.color = 'yellow'
el.textContent = 'hello'

// Can use brsrkr here too
$(el).html('Nice!')

// Query only inside el
$('span', el, span => {
span.style.display = 'none'
})
})

// Find all span inside '#el'
$('span', '#el', span => {
span.style.opacity = 1
})

// Get by index
$('li').get(0)

// Get number of matches
$('li').length

```
ISC licensed. Enjoy!