Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
return a list of all of a DOM nodes parents, optionally filtered
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
index.js
package.json
test.js

README.md

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

Something went wrong with that request. Please try again.