Determine if a
Node
does not exist within a DOM tree.
Node.js >= 10
is required. To install, type this at the command line:
npm install is-dom-detached
ES Module:
import isDetachedNode from 'is-dom-detached';
CommonJS Module:
const isDetachedNode = require('is-dom-detached');
const div = document.createElement('div');
isDetachedNode(div); //-> true
document.body.appendChild(div);
isDetachedNode(div); //-> false