dom-siblings

0.1.0 • Public • Published

dom-siblings

Build Status

Find a DOM element's siblings, optionally filtered by a CSS selector.

Installation

npm install dom-siblings

API

siblings(element, selector)

  • element: a DOM Element.
  • selector: a CSS selector string.
var siblings = require('dom-siblings');
var element = document.querySelector('div');

siblings(element);
// => [Element, Element]
// all sibling elements

siblings(element, '.foo');
// => [Element]
// all sibling elements with class 'foo'

Browser support

  • Google Chrome
  • Firefox 4+
  • Internet Explorer 8+
  • Safari 5+
  • Opera

Package Sidebar

Install

npm i dom-siblings

Weekly Downloads

583

Version

0.1.0

License

MIT

Last publish

Collaborators

  • necolas