Nomenclature Processing Machine
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

querysibling

1.1.3 • Public • Published

querysibling

JavaScript's missing querySibling function.

Demo: https://jsfiddle.net/ryanpcmcquen/rhg3crvp/

Given element .zot, which occurs after .foo, you could do:

querySibling.previous('.zot', '.foo');
 
// => Returns `.foo` node.

If you were at .foo and wanted .zot (a next sibling), you could do:

querySibling.next('.foo', '.zot');
 
// => Returns `.zot` node.
 

It is available via npm for new-school kids (es6):

https://www.npmjs.com/package/querysibling

Or RawGit for old-school kids (es5):

https://cdn.rawgit.com/ryanpcmcquen/querysibling/923c4e5f10610b505f22b7af7ba1a54d94df8f0f/index-es5.js

Keywords

Install

npm i querysibling

DownloadsWeekly Downloads

6

Version

1.1.3

License

GPL-2.0+

Last publish

Collaborators

  • avatar