From 04a01d735471e2427be87ca5cd0df08574c28c6c Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Fri, 3 Jul 2015 15:31:38 +0000 Subject: [PATCH] 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 --- src/wp-admin/js/post.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/js/post.js b/src/wp-admin/js/post.js index 46a5556798..c2a14a647d 100644 --- a/src/wp-admin/js/post.js +++ b/src/wp-admin/js/post.js @@ -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' );