Make WordPress Core

Changeset 33982


Ignore:
Timestamp:
09/10/2015 01:02:05 AM (9 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/edit-comments.js

    r33821 r33982  
    139139
    140140    updateHtmlTitle = function ( diff ) {
    141         var newTitle, regExMatch, titleCount;
     141        var newTitle, regExMatch, titleCount, commentFrag;
    142142
    143143        titleRegEx = titleRegEx || new RegExp( 'Comments (\\([0-9' + thousandsSeparator + ']+\\))?' );
     
    146146        newTitle = adminTitle;
    147147
    148         titleDiv.html( document.title );
    149         titleCount = getCount( titleDiv ) + diff;
     148        commentFrag = titleRegEx.exec( document.title );
     149        if ( commentFrag ) {
     150            commentFrag = commentFrag[0];
     151            titleDiv.html( commentFrag );
     152            titleCount = getCount( titleDiv ) + diff;
     153        } else {
     154            titleDiv.html( 0 );
     155            titleCount = diff;
     156        }
     157
    150158        if ( titleCount >= 1 ) {
    151159            updateCount( titleDiv, titleCount );
Note: See TracChangeset for help on using the changeset viewer.