Alabhya Jindal

DOM Mutation Observer

I created a browser extension that filters out channels from YouTube search.

The extension finds videos on the page, checks if it’s been uploaded by a channel filtered by the user and removes it.

Attaching event listeners wouldn’t have worked because YouTube is a Single Page Application (SPA) where the pages are not reloaded on user actions. I needed a way to listen to changes in the DOM.

Mutation Observer does exactly that. It allows you to listen for page changes, which you can then react to.

I used it to look for and remove videos from the UI on every mutation.