[FIX] web_tour: observe when dom is ready

Start observing the DOM (MutationObserver) only when it's ready.
This commit is contained in:
qsm-odoo
2016-06-22 11:52:42 +02:00
parent 8d09a11cea
commit ec6083c0c3
+10 -6
View File
@@ -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) {