Skip to content

biancojs/query

Folders and files

NameName
Last commit message
Last commit date

Latest commit

18cbe71 · Jan 23, 2023

History

55 Commits
Mar 9, 2022
Sep 18, 2016
Sep 13, 2016
Sep 12, 2016
Jan 23, 2023
Mar 30, 2022
Mar 9, 2022
Mar 9, 2022
Mar 9, 2022
Jun 3, 2018
Jun 3, 2018

Repository files navigation

bianco.query

Build Status NPM version NPM downloads MIT License

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

$

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