Comments: Correct the check for reply element existence in `comment-reply.js`.

`document.getElementById()` returns `null` if no matching element was found, so the previous comparison didn't work as expected.

Follow-up to [47506].

Props mailnew2ster, sarahricker.
Fixes #38009.

git-svn-id: https://develop.svn.wordpress.org/trunk@48876 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-08-27 01:56:39 +00:00
parent c77798da22
commit 3066546426
1 changed files with 1 additions and 1 deletions

View File

@ -408,7 +408,7 @@ window.addComment = ( function( window ) {
var temporaryFormId = config.temporaryFormId;
var temporaryElement = getElementById( temporaryFormId );
var replyElement = getElementById( config.commentReplyTitleId );
var initialHeadingText = ( 'undefined' !== typeof replyElement ) ? replyElement.firstChild.textContent : '';
var initialHeadingText = replyElement ? replyElement.firstChild.textContent : '';
if ( temporaryElement ) {
// The element already exists, no need to recreate.