From 5b3ce72716854ce1f915ae00df778addf6ea6a1c Mon Sep 17 00:00:00 2001 From: Tim Fischbach Date: Mon, 21 Oct 2024 16:27:17 +0200 Subject: [PATCH] Remove DomNodeRemoved handling in wysihtml Chrome removed the DomNodeRemoved event. This now activates a broken interval based workaround that was originally meant for IE 8. Since we trigger `destroy:composer` in `TextAreaInputView`, we can remove the problematic code. --- vendor/assets/javascripts/wysihtml-toolbar.js | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/vendor/assets/javascripts/wysihtml-toolbar.js b/vendor/assets/javascripts/wysihtml-toolbar.js index f1fcca7be..905fe7d0b 100644 --- a/vendor/assets/javascripts/wysihtml-toolbar.js +++ b/vendor/assets/javascripts/wysihtml-toolbar.js @@ -17808,13 +17808,6 @@ wysihtml5.views.View = Base.extend( composer.commands.exec("insertHTML", " "); }; - var handleDomNodeRemoved = function(event) { - if (this.domNodeRemovedInterval) { - clearInterval(domNodeRemovedInterval); - } - this.parent.fire("destroy:composer"); - }; - // Listens to "drop", "paste", "mouseup", "focus", "keyup" events and fires var handleUserInteraction = function (event) { this.parent.fire("beforeinteraction", event).fire("beforeinteraction:composer", event); @@ -18009,19 +18002,6 @@ wysihtml5.views.View = Base.extend( this.focusState = this.getValue(false, false); - // --------- destroy:composer event --------- - container.addEventListener(["DOMNodeRemoved"], handleDomNodeRemoved.bind(this), false); - - // DOMNodeRemoved event is not supported in IE 8 - // TODO: try to figure out a polyfill style fix, so it could be transferred to polyfills and removed if ie8 is not needed - if (!browser.supportsMutationEvents()) { - this.domNodeRemovedInterval = setInterval(function() { - if (!dom.contains(document.documentElement, container)) { - handleDomNodeRemoved.call(this); - } - }, 250); - } - // --------- User interactions -- if (this.config.handleTables) { // If handleTables option is true, table handling functions are bound