Skip to content

Commit

Permalink
fix(widget): Replace DOMSubTreeModified with MutationObserver
Browse files Browse the repository at this point in the history
DOMSubTreeModified has been deprecated since years and  stopped
working in recent Chrome builds.
  • Loading branch information
torotil committed Nov 14, 2024
1 parent dc1ff2a commit 8d14329
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions campaignion_webform_widget/js/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ window.addEventListener("DOMContentLoaded", function() {
messageParent(false);
});

// Update iframe size after AJAX requests.
window.onload = function() {
messageParent(false);
window.addEventListener("DOMSubtreeModified", function() {
(new MutationObserver(function() {
messageParent(false);
}, true);
})).observe(document.body, { subtree: true, childList: true });
}

window.onresize = function() {
Expand Down

0 comments on commit 8d14329

Please sign in to comment.