Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

300
Views
Using MutationObserver, how can I detect a child being removed, even if parent is deleted?

See this:

JavaScript MutationObserver. Observing a child element after observing a parent element triggers no events

If I subscribe to a child after i subscribed to a parent i get no child events.

If I subscribe to document, I get all kinds of events, but if a parent is deleted, then I will not get an event from the parent for a subscribed child.

I do not see how mutation observers are useful at all. Is this really the alternative than to use the deprecated MutationEvent?

https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent

There we have DOMNodeRemovedFromDocument DOMNodeRemoved but with the threat of them possibly stop working any given time.

I do not see how MutationObservers are replacement though.

I would need to jump hoops to get this kind of behavior and likely pay with performance.

I am not prepared to iterate all children of a parent to detect any child nodes that might have subscribed.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!