From 075b264338c511a28e8df88e9db0c08b84af54b1 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 4 Mar 2019 10:28:59 +0100 Subject: [PATCH] DEV: replaces DOMNodeInserted by the better MutationObserver (#6884) --- app/assets/javascripts/discourse/lib/safari-hacks.js.es6 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/lib/safari-hacks.js.es6 b/app/assets/javascripts/discourse/lib/safari-hacks.js.es6 index 026826c540f..eeadb1c3f8a 100644 --- a/app/assets/javascripts/discourse/lib/safari-hacks.js.es6 +++ b/app/assets/javascripts/discourse/lib/safari-hacks.js.es6 @@ -191,7 +191,14 @@ function positioningWorkaround($fixedElement) { }); }, 100); - fixedElement.addEventListener("DOMNodeInserted", checkForInputs); + const config = { + childList: true, + subtree: true, + attributes: false, + characterData: false + }; + const observer = new MutationObserver(checkForInputs); + observer.observe(fixedElement, config); } export default positioningWorkaround;