Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

yields/traverse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

traverse

low level traverse function, inspired by $.dir

Installation

Install with component(1):

$ component install yields/traverse

API

traverse(property, element, [selector|element, [length]])

Traverse using the given property on element getting elements that match the given selector until len is reached.

if selector is omitted, all elements are returned. len is defaulted to 1.

Example

var traverse = require('traverse');

// getting all `<p>` parents.

traverse('parentNode', el, 'p', Infinity);

// getting a single `<p>` sibling

traverse('nextSibling', el, 'p');

// traversing to an element

traverse('parentNode', el, document.body);

License

MIT

About

low level traverse function, inspired by $.dir

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •