JSFiddle - React, Tailwind, and code Playground
by tdecs
JavaScript
var Utils = {
contains: function (el1, el2) {
return (el1 === window && (el2 && (el2 === window || el2.nodeType))) || ((el1 && el1.nodeType) && (el2 && el2.nodeType)) ? (el1.contains ? el1.contains(el2) : true) : false;
}
};
Utils.contains(window, null); // false
Utils.contains({}, {}); // false
Utils.contains([]+[], {}+{}); // false
Utils.contains(window, 0|0); // false