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
This commit is contained in:
Scott Taylor 2015-09-10 01:02:05 +00:00
parent cc18f258cb
commit c83106d13f

View File

@ -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 || $( '<div />' );
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 );