Comments: Check if comment form element exists before adding a key handler to detect the cmd/ctrl-enter key press.

Follow-up to [45790].

Props raamdev.
Fixes #48543. See #41545.

git-svn-id: https://develop.svn.wordpress.org/trunk@46700 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-11-11 11:49:29 +00:00
parent 1ee0c8e54f
commit ae487b5f67

View File

@ -106,7 +106,9 @@ window.addComment = ( function( window ) {
}
};
commentFormElement.addEventListener( 'keydown', submitFormHandler );
if ( commentFormElement ) {
commentFormElement.addEventListener( 'keydown', submitFormHandler );
}
var links = replyLinks( context );
var element;