Mutation Events

2000 - 2024
dead
november 2000 is when the w3c made mutation events a recommendation, and the design was understood as a mistake within a few years of shipping. the events fired synchronously, which meant your handler ran in the middle of the browser's own surgery on the document tree, and that made everything slow while producing a long run of crashes. the spec marked them legacy in 2011 and offered mutationobserver instead in 2012. chrome switched them off for every user on 23 july 2024, twenty-four years after shipping them and thirteen after telling everyone not to use them.

~ the goodbye ~

The DOM Level 2 Events Recommendation became official on 13 November 2000, and tucked into it was a module for watching the document change. If something inserted a node, removed a node, edited text, or touched an attribute, the browser would fire an event and your code could respond. The names were DOMNodeInserted, DOMNodeRemoved, DOMSubtreeModified, DOMCharacterDataModified, DOMNodeInsertedIntoDocument and DOMNodeRemovedFromDocument.

For a decade this was the only answer to a question that gets asked constantly in real applications: how do I find out that the page changed when I was not the one who changed it. Widget libraries needed it, and so did anything that had to coexist with code it did not control, which in the jQuery era meant a very large amount of the web.

The problem was in the word synchronous. The event fired during the mutation, not after it, so a handler executed while the browser was partway through rebuilding its own tree. Handlers could mutate the tree further and fire more events from inside the first one. The browser had to abandon whole categories of optimization because it could no longer assume that a batch of DOM work would complete without arbitrary script running in the middle. Chrome's own write-up lists the consequences plainly: verbose, fires too often, slow because of event propagation, and a long-standing source of crashes and security bugs.

The replacement arrived in 2012 and inverted the design. MutationObserver batches changes and delivers them asynchronously once the browser has finished its work, which costs you immediacy and buys back everything else. Every modern browser has supported it since 2013. The old events stayed in the platform for another eleven years regardless, deprecated and still perfectly functional.

~ the chronicle ~

Born13 November 2000, in the DOM Level 2 Events Recommendation
PeakThe only way to watch the DOM change, for about twelve years
Killed23 July 2024, in Chrome 127
Lifespan23 years
Made byThe W3C DOM working group
Killed byMutationObserver, plus a decade of crash reports

~ why they were broken ~

The clearest way to see the flaw is to consider what a handler is allowed to do. DOMNodeRemoved fires before the node actually leaves the tree, so the handler sees a document in an intermediate state and can modify it. Insert a node from inside a removal handler and you fire an insertion event from inside a removal event, from inside whatever operation triggered the removal. Engine code that calls into script in the middle of a tree operation has to be defensive at every step, and the bugs that come out of that are exactly the kind that become security advisories.

There is a reason the spec authors never made any mutation event cancelable, and they wrote it down in 2000: it is very hard to use DOM interfaces that modify a document when any given change might or might not actually take place. That caveat is in the 2000 Recommendation itself, two paragraphs below the feature it describes.

~ the long goodbye ~

The timetable is the interesting part, because standards bodies and browser vendors publish their removals with dates attached in a way that dead products almost never do. The UI Events spec moved mutation events to its legacy section in 2011. Chrome filed a deprecation trial, started printing console warnings that showed up in enterprise software everywhere, and set the removal for Chrome 127, which reached stable on 23 July 2024. For anyone who still needed them, a deprecation trial and a MutationEventsEnabled enterprise policy bought roughly nine more months, expiring with Chrome 135 in April 2025.

Twenty-four years from recommendation to removal, with thirteen of those years spent officially deprecated, is a reasonable measure of how long it takes to get something out of the web platform once it is in.

~ leave a rose ~

an anonymous tribute. one rose per visitor per day.

@}-->-- ... roses left here

~ leave a wreath ~

a rose fades by morning. a wreath stays on this grave for good, with your name on it.

from $1, paid once through stripe. it keeps the graveyard running: the hosting and the nightly digging. adopt it and the headstone reads "maintained in memory by" you. the groundskeeper plants new wreaths at the next tending, usually within a day.

» one email a week: new graves and the anniversaries of the dead. subscribe

~ leave a note ~

visitors before you have left these graveside notes. anonymous welcome.

other protocols: GeoURL, Twitter @Anywhere, The Locker Project, 6bone

also died in the 2020s: Fitbit Versa, Facebook Campus, A Plus

« previous  ·  random  ·  next »