fix attached to moving target : keep menu entry after board refresh -- observe stable parent, not replaced #board-container (v1.0.2)
This commit is contained in:
@@ -36,16 +36,21 @@
|
||||
}
|
||||
|
||||
function init() {
|
||||
if (!document.getElementById("board")) {
|
||||
var container = document.getElementById("board-container");
|
||||
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
|
||||
relocate();
|
||||
|
||||
var container = document.getElementById("board-container");
|
||||
|
||||
if (container && window.MutationObserver) {
|
||||
new MutationObserver(relocate).observe(container, { childList: true, subtree: true });
|
||||
// BoardDragAndDrop.refresh() does $("#board-container").replaceWith(data) on every
|
||||
// drag-and-drop and poll refresh, so an observer bound to #board-container would be
|
||||
// left watching a detached node and never fire again (the entry vanishes until F5).
|
||||
// Observe the stable parent instead: it survives the swap, and its childList mutation
|
||||
// fires exactly when the container is replaced, so relocate() re-runs on the new DOM.
|
||||
if (window.MutationObserver && container.parentNode) {
|
||||
new MutationObserver(relocate).observe(container.parentNode, { childList: true, subtree: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class Plugin extends Base
|
||||
|
||||
public function getPluginVersion()
|
||||
{
|
||||
return '1.0.1';
|
||||
return '1.0.2';
|
||||
}
|
||||
|
||||
public function getPluginHomepage()
|
||||
|
||||
Reference in New Issue
Block a user