npm.io
0.0.3 • Published 13 years ago

ancestors

Licence
MIT
Version
0.0.3
Deps
0
Vulns
0
Weekly
0
Stars
4

ancestors

browser support

return a list of a node's ancestors, optionally filtered with a provided function.


var parents = require('ancestors')
  , el = document.getElementById('target')


var p = parents(el)
// [list, of, parent, elements]

var p = parents(el, function(node) { return node.tagName == 'div' })
// [list, of, parent, div, elements] 

API

parents(element[, filterFunction]) -> [list of elements]

License

MIT

Keywords