bianco.query

Modern DOM query selectors helpers written in es2015

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
bianco.query
121.1.42 years ago8 years agoMinified + gzip package size for bianco.query in KB

Readme

bianco.query
!Build Statusci-imageci-url !NPM versionnpm-version-imagenpm-url !NPM downloadsnpm-downloads-imagenpm-url !MIT Licenselicense-imagelicense-url
Modern DOM query selectors helpers written in es2015

Usage

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'))

API

Table of Contents

*   [Parameters](#parameters)

$

Simple helper to find DOM nodes returning them as array like loopable object

Parameters

  • selector (string | DOMNodeList) either the query or the DOM nodes to arraify
  • scope HTMLElement context defining where the query will search for the DOM nodes

Returns Array DOM nodes found as array