vanillajs-browser-helpers
Version:
Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS in the browser
18 lines (17 loc) • 612 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const getCurrentDocument_1 = __importDefault(require("./getCurrentDocument"));
/**
* Is the given DOM node inserted into the DOM
*
* @param elm - The element to check
* @return Is it a DOM node in the DOM or not
*/
function inDOM(elm) {
const doc = (0, getCurrentDocument_1.default)(elm);
return !!doc && doc !== elm && doc.contains(elm);
}
exports.default = inDOM;