diff options
author | Byron Jones <glob@mozilla.com> | 2014-05-02 08:20:37 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-05-02 08:20:37 +0200 |
commit | 01350d7f6d66796ac0f18d6ab3582cd60f2525c5 (patch) | |
tree | 54d3926065495accbbc645733eb5c11ee55c4d88 /extensions | |
parent | 261f42c8395018c8baf7d058ecc4f4a331e1fdef (diff) | |
download | bugzilla-01350d7f6d66796ac0f18d6ab3582cd60f2525c5.tar.gz bugzilla-01350d7f6d66796ac0f18d6ab3582cd60f2525c5.tar.xz |
Bug 1004229: "TypeError: lastCommentDiv.parentNode is null" from inline history when the last comment is a 'duplicate' comment
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/InlineHistory/web/inline-history.js | 11 |
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]; |