Make WordPress Core

Changeset 46706


Ignore:
Timestamp:
11/11/2019 04:57:05 PM (5 years ago)
Author:
whyisjake
Message:

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.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/js/_enqueues/lib/comment-reply.js

    r45792 r46706  
    107107        };
    108108
    109         commentFormElement.addEventListener( 'keydown', submitFormHandler );
     109        if ( commentFormElement ) {
     110            commentFormElement.addEventListener( 'keydown', submitFormHandler );
     111        }
    110112
    111113        var links = replyLinks( context );
Note: See TracChangeset for help on using the changeset viewer.