summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/InlineHistory/web/inline-history.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/extensions/InlineHistory/web/inline-history.js b/extensions/InlineHistory/web/inline-history.js
index c59c2932c..685798ec0 100644
--- a/extensions/InlineHistory/web/inline-history.js
+++ b/extensions/InlineHistory/web/inline-history.js
@@ -34,6 +34,7 @@ var inline_history = {
dupeId = match[1];
// remove the element
comment.parentNode.removeChild(comment);
+ comments[i] = false;
// update the html for the history item to include the comment number
if (dupeId == 0)
continue;
@@ -52,6 +53,8 @@ var inline_history = {
}
}
}
+ if (!comments[i])
+ continue;
// remove 'Additional hours worked: ' comments
var commentNodes = comments[i].childNodes;
@@ -65,6 +68,14 @@ var inline_history = {
}
}
+ // remove deleted comments
+ for (var i = 0; i < comments.length; i++) {
+ if (!comments[i]) {
+ comments.splice(i, 1);
+ i--;
+ }
+ }
+
// ensure new items are placed immediately after the last comment
if (!comments.length) return;
var lastCommentDiv = comments[comments.length - 1];