From 8a740b765aef6a4f8cc5aa261669331d9617bd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Tue, 30 Dec 2014 20:23:32 +0100 Subject: [PATCH] Fix DOMfilter when replacing multiple occasions Previously, it would sometimes forget things at the end --- js/filters.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/filters.js b/js/filters.js index 886dc6b..4f0d6d9 100644 --- a/js/filters.js +++ b/js/filters.js @@ -94,13 +94,15 @@ weechat.filter('DOMfilter', ['$filter', '$sce', function($filter, $sce) { } else { parent.appendChild(newNode); } + return newNode; } } // recurse + if (node === undefined || node === null) return; node = node.firstChild; while (node) { - process(node); - node = node.nextSibling; + var nextNode = process(node); + node = (nextNode ? nextNode : node).nextSibling; } };