Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

dom-siblings

necolas2.5kMIT0.1.0

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

browser, dom, element, siblings

readme

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

changelog

=== HEAD

=== 0.1.0

  • Initial release.