• Resolved abeyance

    (@abeyance)


    I have the following error which goes against best practices when examining page quality:

    DOM Mutation Events, including DOMSubtreeModified, DOMNodeInserted, DOMNodeRemoved, DOMNodeRemovedFromDocument, DOMNodeInsertedIntoDocument, and DOMCharacterDataModified are deprecated (https://w3c.github.io/uievents/#legacy-event-types) and will be removed. Please use MutationObserver instead.

    The piece of code is part of the MailerLite – WooCommerce integration plugin, in public.js:10.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter abeyance

    (@abeyance)

    Here’s the updated version I am using:

    // Select the target node
    var target = document; // You want to observe changes in the entire document
    
    // Create a new MutationObserver instance
    var observer = new MutationObserver(function(mutations) {
    mutations.forEach(function(mutation) {
    if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {
    Array.from(mutation.removedNodes).forEach(function(node) {
    if (node.nodeType === Node.ELEMENT_NODE) {
    var targetId = node.id?.replace('_field', '');
    if (allowedInputs.includes(targetId)) {
    triggerAddEvents();
    }
    }
    });
    }
    });
    });
    
    // Configuration of the observer:
    var config = { childList: true, subtree: true };
    
    // Start observing the target node for configured mutations
    observer.observe(target, config);
    Plugin Author MailerLite

    (@mailerlite)

    Hi @abeyance

    Thank you for all the details you shared, our team investigated the issue and we would like to inform you that this issue has been resolved in the new version 2.1.12 we have released. Please, update your plugin to this latest version.

    We will mark this thread as resolved, for now. However, please don’t hesitate to reach out if you notice anything.

    Thank you,
    MailerLite Team

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Uses Deprecated APIs’ is closed to new replies.