DocumentFragment.childElementCount

The Document.childElementCount read-only property returns the number of child elements of a DocumentFragment.

To get the number of children of a specific element, see Element.childElementCount.

Syntax

fragment.childElementCount;

Example

let fragment = new DocumentFragment()
fragment.childElementCount; // 0

let paragraph = document.createElement('p')
fragment.appendChild(paragraph)

fragment.childElementCount; // 1

Specifications

Specification
DOM
The definition of 'ParentNode.childElementCount' in that specification.

Browser compatibility

BCD tables only load in the browser

See also