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

Brings [46700] to the 5.3 branch.

Follow-up to [45790].
Props raamdev.
Fixes #48543. See #41545.



git-svn-id: https://develop.svn.wordpress.org/branches/5.3@46706 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jake Spurlock 2019-11-11 16:57:05 +00:00
parent 7f5049eff8
commit e6ecd67461

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;