school Are you a developer in an agency in the UK, Indonesia or India? Find out more about our free 2 day Progressive Web Apps training .

Avoids Mutation Events In Its Own Scripts

Why the audit is important

The following mutation events harm performance and are deprecated in the DOM events spec:

  • DOMAttrModified
  • DOMAttributeNameChanged
  • DOMCharacterDataModified
  • DOMElementNameChanged
  • DOMNodeInserted
  • DOMNodeInsertedIntoDocument
  • DOMNodeRemoved
  • DOMNodeRemovedFromDocument
  • DOMSubtreeModified

How to pass the audit

Under URLs, Lighthouse reports each mutation event listener that it found in your code. Replace each of these mutation events with a MutationObserver. See MutationObserver on MDN for more help.

How the audit is implemented

This section explains how this audit is implemented, so that you can understand how the audit's score is calculated.

Lighthouse collects all of the event listeners on the page, and flags any listener that uses one of the types listed in Why the audit is important.