A jQuery wrapper/plugin for mutation-summary, the DOM mutation-observers wrapper.
Latest commit 64718c1 Feb 12, 2015 @joelpurra Update copyright years


jquery-mutation-summary javascript library

A jQuery wrapper/plugin for mutation-summary, the DOM mutation-observers wrapper. It adds easy, chainable .mutationSummary() calls to your jQuery objects.

Mutation Summary is a JavaScript library that makes observing changes to the DOM fast, easy and safe.

The Mutation Summary library aggregates multiple DOM mutations to a neat changeset, optionally filtered by CSS-style selectors. Have a look at this fun and informative 8 minute screen cast by Rafael Z Weinstein, the creator of mutation-summary.

Get it

To include dependencies, make sure to get the submodules too.

git clone --recursive git://github.com/joelpurra/jquery-mutation-summary.git



See mutation-summary API reference for details on callback(summary[]), queries and other options.

Public methods

// Connect mutation observation
$(selector).mutationSummary("connect", options);
$(selector).mutationSummary("connect", callback(summary[]) [, observeOwnChanges], queries);

// Diconnect all mutation observation

// To disconnect a previous "connect" call only, pass the same parameters
$(selector).mutationSummary("disconnect", options);
$(selector).mutationSummary("disconnect", callback(summary[]) [, observeOwnChanges], queries);


// Use document to listen to all events on the page (you might want to be more specific)
var $observerSummaryRoot = $(document);

// Simplest callback, just logging to the console
function callback(summaries){

// Connect mutation-summary
$observerSummaryRoot.mutationSummary("connect", callback, [{ all: true }]);

// Do something to trigger mutationSummary
$("<a />", { href: "http://joelpurra.github.com/jquery-mutation-summary"}).text("Go to the jquery-mutation-summary website").appendTo("body");

// Disconnect when done listening

Original purpose

Developed to get a jQuery chainable version of the mutation-summary library.

DOM Mutation Observers are useful for watching changes made to the DOM elements (including their attributes and contents) that are out of your control. These external changes may come from other jQuery plugins, non-jQuery scripts, legacy code or even flash objects that modifies the page around it. If you have previously used DOM Mutation Events, please note that they have been deprecated.


jquery-mutation-summary's runtime dependencies are

Browser compatibility

Should be as compatible as mutation-summary is - see the wiki page on browser support for Mutation Observers. jQuery is assumed to be available in these environments.


Patches/pull requests welcome!

  • Write tests.
  • Write example callback filters that act only on, for example, removed attributes or added elements.
  • Add support for namespaced/filtered events, for example mutationSummary.element.added or mutationSummary.attribute.valueChanged.


Copyright (c) 2012, 2013, 2014, 2015, Joel Purra http://joelpurra.com/ All rights reserved.

When using jquery-mutation-summary, comply to at least one of the three available licenses: BSD, MIT, GPL. Please see the LICENSE file for details.