From 630ac459485fce73f7837b7743a4ef336efcd060 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 15 Nov 2017 16:31:26 +0100 Subject: [PATCH] Fix laggy and blinking tooltips --- www/common/common-interface.js | 18 ++++++++++++------ www/poll/render.js | 4 ++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 76a603836..cb3e5b16a 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -515,7 +515,8 @@ define([ distance: 0, performance: true, dynamicTitle: true, - delay: [delay, 0] + delay: [delay, 0], + sticky: true }); }; // This is the robust solution to remove dangling tooltips @@ -534,17 +535,22 @@ define([ var observer = new MutationObserver(function(mutations) { var removed = false; mutations.forEach(function(mutation) { - for (var i = 0; i < mutation.addedNodes.length; i++) { - $(mutation.addedNodes[i]).find('[title]').each(addTippy); + if (mutation.type === "childList") { + for (var i = 0; i < mutation.addedNodes.length; i++) { + $(mutation.addedNodes[i]).find('[title]').each(addTippy); + } + for (var j = 0; j < mutation.removedNodes.length; j++) { + removed |= checkRemoved(mutation.removedNodes[j]); + } } - for (var j = 0; j < mutation.removedNodes.length; j++) { - removed |= checkRemoved(mutation.removedNodes[j]); + if (mutation.type === "attributes" && mutation.attributeName === "title") { + addTippy(0, mutation.target); } }); if (removed) { UI.clearTooltips(); } }); observer.observe($('body')[0], { - attributes: false, + attributes: true, childList: true, characterData: false, subtree: true diff --git a/www/poll/render.js b/www/poll/render.js index f7625bd4e..7dd59d168 100644 --- a/www/poll/render.js +++ b/www/poll/render.js @@ -425,6 +425,10 @@ var Renderer = function (APP) { var diffOptions = { preDiffApply: function (info) { if (!diffIsInput(info)) { return; } + if (info.diff.action === "removeAttribute" && + (info.diff.name === "aria-describedby" || info.diff.name === "data-original-title")) { + return; + } switch (getInputType(info)) { case 'number': //console.log('checkbox');