JSPM

ancestors

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4564
  • Score
    100M100P100Q114566F
  • License MIT

return a list of all of a DOM nodes parents, optionally filtered

Package Exports

  • ancestors

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ancestors) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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