ga-siblings
v1.0.1
Published
Get all siblings of an element (PlainJS.com solution)
Downloads
1
Readme
#ga-siblings
Get all siblings of an element.
This solution as well as usage notes below brazenly stolen from PlainJS.com's siblings solution. See full documentation there.
##Installation
npm install ga-siblings --save
##Usage
// Require module
var getSiblings = require('ga-siblings');
// Get all siblings of el:
el = document.querySelector('div');
var sibs = getSiblings(el);
###Optional filtering
// Example filter function
function exampleFilter(el) {
return el.nodeName.toLowerCase() == 'a';
}
// Get only anchor element siblings of el
el = document.querySelector('div');
var sibs_a = getSiblings(el, exampleFilter);
##Develop with Gulp
Use Git Flow, always work in develop
branch.
- Install development dependencies:
npm install
- Run
gulp watch
- Work in
src/
Builds are now in dist/