Wondering what’s next for npm?Check out our public roadmap! »

    ancestors

    0.0.3 • Public • Published

    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

    none

    Install

    npm i ancestors

    DownloadsWeekly Downloads

    2,319

    Version

    0.0.3

    License

    MIT

    Last publish

    Collaborators

    • avatar