From: Byron Jones Date: Wed, 9 Apr 2014 15:21:04 +0000 (+0800) Subject: Bug 974411: js/comments.js::toggle_all_comments() shouldn't try to match X-Git-Tag: bugzilla-4.5.3~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad9b149541d21e6e4e782da9785ba5fd16e9ccc7;p=thirdparty%2Fbugzilla.git Bug 974411: js/comments.js::toggle_all_comments() shouldn't try to match non-comment elements r=gerv, a=glob --- diff --git a/js/comments.js b/js/comments.js index 8d314de15e..9150c72ec0 100644 --- a/js/comments.js +++ b/js/comments.js @@ -40,13 +40,16 @@ function toggle_all_comments(action) { var comment = comments[i]; if (!comment) continue; - - var id = comments[i].id.match(/\d*$/); + var id = comment.id.match(/^comment_text_(\d*)$/); + if (!id) + continue; + id = id[1]; var link = document.getElementById('comment_link_' + id); - if (action == 'collapse') + if (action == 'collapse') { collapse_comment(link, comment, id); - else + } else { expand_comment(link, comment, id); + } } }