(mutationsList, observer)
| 99 | // 后续动态插入的 Video Audio 标签(插入事件) |
| 100 | function insPage() { |
| 101 | const callback = (mutationsList, observer) => { |
| 102 | for (const mutation of mutationsList) { |
| 103 | for (const target of mutation.addedNodes) { |
| 104 | if (target.nodeType != 1) break |
| 105 | //console.log('所有插入:', target) |
| 106 | if (target.tagName === 'VIDEO' || target.tagName === 'AUDIO') { |
| 107 | //console.log('后续插入1:', target) |
| 108 | isFirstEvent(target) |
| 109 | } else if (target.tagName === 'DIV') { |
| 110 | target.querySelectorAll('video, audio').forEach(function(_this){ |
| 111 | //console.log('后续插入2:', _this) |
| 112 | isFirstEvent(_this) |
| 113 | }) |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | }; |
| 118 | const observer = new MutationObserver(callback); |
| 119 | observer.observe(document, { childList: true, subtree: true }); |
| 120 | } |
nothing calls this directly
no test coverage detected