Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有一个回调函数和两个MutationObservers用于两个不同的 dom 节点,有没有办法告诉哪个观察者在调用时触发了回调?回调需要执行的工作基本相似,因此为每个观察者创建一个似乎是不可取的。
具体MutationObserver作为回调的第二个参数提供。请参阅MDN 文档。
MutationObserver