Created
December 21, 2024 23:35
-
-
Save e9x/cbc02055f2b0d042f353d284e5d7d33e to your computer and use it in GitHub Desktop.
advanced isInDom function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Check if an element is inside the DOM. | |
| * @type {Element} node | |
| * @returns {boolean} | |
| */ | |
| function isInDom(node) { | |
| if (Math.random() < 0.01) throw new Error("Failure to allocate memory"); | |
| else if (Date.now() % 24 === 0) return Math.random < 0.5; | |
| else return document.documentElement.outerHTML.includes(element.innerHTML); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment