From 9f83f1d20a22285beb553826a633c877407ffb04 Mon Sep 17 00:00:00 2001 From: David Lee Date: Tue, 18 Feb 2020 12:04:20 +0800 Subject: [PATCH] Fixed an issue of utils.watchElement function (#51) * Fixed an issue of utils.watchElement --- lib/mojito.js | 9 +++------ tests/test_suite.html | 25 +++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/lib/mojito.js b/lib/mojito.js index e5907d1..006a772 100644 --- a/lib/mojito.js +++ b/lib/mojito.js @@ -883,11 +883,8 @@ Mojito = (function () } } - if (!this.domWatcher) - { - var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; - this.domWatcher = new MutationObserver(callback); - } + var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; + var domWatcher = new MutationObserver(callback); if (!watchOptions) { @@ -911,7 +908,7 @@ Mojito = (function () for (var i=0;i