From c83106d13f1d96be86047ff0a98f71ce354a126c Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 10 Sep 2015 01:02:05 +0000 Subject: [PATCH] After [33821], when dynamically updating the document title text of the Comments List Table page, operate only on the fragment that contains the comment count. This prevents us from including other numbers that may be present in the other title parts (site title, etc). See #33414. git-svn-id: https://develop.svn.wordpress.org/trunk@33982 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/edit-comments.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/js/edit-comments.js b/src/wp-admin/js/edit-comments.js index 92f8d367e1..75c2527bc0 100644 --- a/src/wp-admin/js/edit-comments.js +++ b/src/wp-admin/js/edit-comments.js @@ -138,15 +138,23 @@ setCommentsList = function() { }; updateHtmlTitle = function ( diff ) { - var newTitle, regExMatch, titleCount; + var newTitle, regExMatch, titleCount, commentFrag; titleRegEx = titleRegEx || new RegExp( 'Comments (\\([0-9' + thousandsSeparator + ']+\\))?' ); // count funcs operate on a $'d element titleDiv = titleDiv || $( '
' ); newTitle = adminTitle; - titleDiv.html( document.title ); - titleCount = getCount( titleDiv ) + diff; + commentFrag = titleRegEx.exec( document.title ); + if ( commentFrag ) { + commentFrag = commentFrag[0]; + titleDiv.html( commentFrag ); + titleCount = getCount( titleDiv ) + diff; + } else { + titleDiv.html( 0 ); + titleCount = diff; + } + if ( titleCount >= 1 ) { updateCount( titleDiv, titleCount ); regExMatch = titleRegEx.exec( document.title );