summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2016-06-20 12:18:02 +0200
committerqsm-odoo <qsm@odoo.com>2016-06-22 11:52:42 +0200
commitec6083c0c3b0de2aa9f794ff0a3602df2ce5f1c8 (patch)
tree75dae32903370a971a5854eadd52ba99fd46df9f
parent8d09a11ceabcf284b38a1d1622df4392a2bb197f (diff)
[FIX] web_tour: observe when dom is ready
Start observing the DOM (MutationObserver) only when it's ready.
-rw-r--r--addons/web_tour/static/src/js/tour_service.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/addons/web_tour/static/src/js/tour_service.js b/addons/web_tour/static/src/js/tour_service.js
index 4856e920076..608e63527fe 100644
--- a/addons/web_tour/static/src/js/tour_service.js
+++ b/addons/web_tour/static/src/js/tour_service.js
@@ -33,15 +33,19 @@ return session.is_bound.then(function () {
}
}, 500, {leading: false});
var observer = new MutationObserver(check_tooltip);
- var observe = observer.observe.bind(observer, document.body, {
- attributes: true,
- childList: true,
- subtree: true,
- });
+ var observe = function () {
+ $(function () {
+ observer.observe(document.body, {
+ attributes: true,
+ childList: true,
+ subtree: true,
+ });
+ });
+ };
// Enable the MutationObserver for the admin or if a tour is running, when the DOM is ready
if (session.is_admin || tour.running_tour) {
- $(observe);
+ observe();
}
// Override the TourManager so that it enables/disables the observer when necessary
if (!session.is_admin) {