0.1.0 • Published 9 years ago

dom-siblings v0.1.0

Weekly downloads
423
License
MIT
Repository
github
Last release
9 years ago

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