Check if `commentReply` exists before trying to work with it.

Fixes a bug that caused the save/publish flow to be interrupted by an AYS.

Introduced in [33024].
See #29457.



git-svn-id: https://develop.svn.wordpress.org/trunk@33066 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Konstantin Obenland 2015-07-03 15:31:38 +00:00
parent 3baf370b28
commit 04a01d7354
1 changed files with 7 additions and 3 deletions

View File

@ -266,9 +266,13 @@ jQuery(document).ready( function($) {
wp.autosave.server.suspend();
}
// Close the comment edit/reply form if open to stop the form
// action from interfering with the post's form action.
commentReply.close();
if ( typeof commentReply !== 'undefined' ) {
/*
* Close the comment edit/reply form if open to stop the form
* action from interfering with the post's form action.
*/
commentReply.close();
}
releaseLock = false;
$(window).off( 'beforeunload.edit-post' );