(node: Node, element: HTMLElement)
| 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) => { |
no test coverage detected