From 3066546426626f47849ac07ec4581ca05a886da0 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 27 Aug 2020 01:56:39 +0000 Subject: [PATCH] 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 --- src/js/_enqueues/lib/comment-reply.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/_enqueues/lib/comment-reply.js b/src/js/_enqueues/lib/comment-reply.js index 1f111230c9..d86403bbeb 100644 --- a/src/js/_enqueues/lib/comment-reply.js +++ b/src/js/_enqueues/lib/comment-reply.js @@ -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.