Björn be2ee1311e | 5 years ago | |
---|---|---|
.. | ||
LICENSE | 5 years ago | |
README.md | 5 years ago | |
index.js | 5 years ago | |
index.next.js | 5 years ago | |
package.json | 5 years ago |
Modern DOM query selectors helpers written in es2015
import $ from 'bianco.query'
const footer = document.querySelector('.main-footer')
const header = document.querySelector('.main-header')
// convert DOM nodes to arrays
$(footer)
.concat($(header))
.forEach(el => el.classList.add('fade-in'))
// handle DOM queries
$('h1', 'main').forEach(h1 => h1.classList.add('main-title'))
Simple helper to find DOM nodes returning them as array like loopable object
selector
(string | DOMNodeList) either the query or the DOM nodes to arraifyctx
HTMLElement context defining where the query will search for the DOM nodesReturns Array DOM nodes found as array