lib/jsdom/living/helpers/mutation-observers.js
function notifyMutationObservers() {
  mutationObserverMicrotaskQueueFlag = false;

  const notifyList = [...activeMutationObservers].sort((a, b) => a._id - b._id);
  activeMutationObservers.clear();

  const signalList = [...signalSlotList];
  signalSlotList.splice(0, signalSlotList.length);

  for (const mo of notifyList) {
    const records = [...mo._recordQueue];
    mo._recordQueue = [];

    for (const node of mo._nodeList) {
      node._registeredObserverList = node._registeredObserverList.filter(registeredObserver => {
        return registeredObserver.source !== mo;
      });

      if (records.length) {
        try {
          mo._callback(
            records.map(idlUtils.wrapperForImpl),
            idlUtils.wrapperForImpl(mo)
          );
        } catch (e) {
          const { target } = records[0];
          const window = target._ownerDocument._defaultView;

          reportException(window, e);
        }
      }
    }
  }

  for (const slot of signalList) {
    const slotChangeEvent = Event.createImpl(
      [
        "slotchange",
        { bubbles: true }
      ],
      { isTrusted: true }
    );

    slot._dispatch(slotChangeEvent);
  }
}
function notifyMutationObservers() {
  mutationObserverMicrotaskQueueFlag = false;

  const notifyList = [...activeMutationObservers].sort((a, b) => a._id - b._id);
  activeMutationObservers.clear();

  const signalList = [...signalSlotList];
  signalSlotList.splice(0, signalSlotList.length);

  for (const mo of notifyList) {
    const records = [...mo._recordQueue];
    mo._recordQueue = [];

    for (const node of mo._nodeList) {
      node._registeredObserverList = node._registeredObserverList.filter(registeredObserver => {
        return registeredObserver.source !== mo;
      });

      if (records.length) {
        try {
          mo._callback(
            records.map(idlUtils.wrapperForImpl),
            idlUtils.wrapperForImpl(mo)
          );
        } catch (e) {
          const { target } = records[0];
          const window = target._ownerDocument._defaultView;

          reportException(window, e);
        }
      }
    }
  }

  for (const slot of signalList) {
    const slotChangeEvent = Event.createImpl(
      [
        "slotchange",
        { bubbles: true }
      ],
      { isTrusted: true }
    );

    slot._dispatch(slotChangeEvent);
  }
}
function notifyMutationObservers ( ) { mutationObserverMicrotaskQueueFlag = false ; const notifyList = [ ... activeMutationObservers ] . sort ( ( a , b ) => a . _id - b . _id ) ; activeMutationObservers . clear ( ) ; const signalList = [ ... signalSlotList ] ; signalSlotList . splice ( 0 , signalSlotList . length ) ; for ( const mo of notifyList ) { const records = [ ... mo . _recordQueue ] ; mo . _recordQueue = [ ] ; for ( const node of mo . _nodeList ) { node . _registeredObserverList = node . _registeredObserverList . filter ( registeredObserver => { return registeredObserver . source !== mo ; } ) ; if ( records . length ) { try { mo . _callback ( records . map ( idlUtils . wrapperForImpl ) , idlUtils . wrapperForImpl ( mo ) ) ; } catch ( e ) { const { target } = records [ 0 ] ; const window = target . _ownerDocument . _defaultView ; reportException ( window , e ) ; } } } } for ( const slot of signalList ) { const slotChangeEvent = Event . createImpl ( [ "slotchange" , { bubbles : true } ] , { isTrusted : true } ) ; slot . _dispatch ( slotChangeEvent ) ; } }
https://dom.spec.whatwg.org/#notify-mutation-observers
https : // dom . spec . whatwg . org / #notify - mutation - observers