MCPcopy Create free account
hub / github.com/Barrior/JParticles / checkElementRemoved

Function checkElementRemoved

src/utils/dom.ts:44–58  ·  view source on GitHub ↗
(node: Node, element: HTMLElement)

Source from the content-addressed store, hash-verified

42 window.MutationObserver || window.WebKitMutationObserver
43
44 const checkElementRemoved = (node: Node, element: HTMLElement) => {
45 if (node === element) {
46 return true
47 }
48 if (isElement(node)) {
49 const children = (node as HTMLElement).children
50 let length = children.length
51 while (length--) {
52 if (checkElementRemoved(children[length], element)) {
53 return true
54 }
55 }
56 }
57 return false
58 }
59
60 const useMutation = (element: HTMLElement, callback: () => void) => {
61 const observer = new MutationObserver((mutations, observer) => {

Callers 2

useMutationFunction · 0.85
DOMNodeRemovedFunction · 0.85

Calls 1

isElementFunction · 0.90

Tested by

no test coverage detected