deep-child-element-count
v1.0.0
Published
ParentNode.childElementCount but including all nested children
Downloads
10
Readme
deep-child-element-count
Like ParentNode.childElementCount
but counting all the nested children too.
Example:
const deepChildElementCount = require('deep-child-element-count')
var container = document.createElement('div')
var firstChild = document.createElement('div')
container.appendChild(firstChild)
var secondChild = document.createElement('div')
var containedChild = document.createElement('div')
secondChild.appendChild(containedChild)
container.appendChild(secondChild)
console.log(container.childElementCount)
// => 2
console.log(deepChildElementCount(container))
// => 3