From bac1ada04dfebbcad1263fe83f6b874ca4926c27 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 28 Nov 2020 12:46:05 +0000 Subject: [PATCH] Quick/Bulk Edit: Fix `undefined` error when initializing UI Autocomplete 1.12.1 on non-existing element and then attempting to use the autocomplete instance. Example: `jQuery( '#nonexisting' ).autocomplete().autocomplete( 'instance' ).something`. Props _luigi, sabernhardt, donmhico, azaozz. Fixes #51872. Built from https://develop.svn.wordpress.org/trunk@49703 git-svn-id: http://core.svn.wordpress.org/trunk@49426 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/inline-edit-post.js | 5 +++++ wp-admin/js/inline-edit-post.min.js | 2 +- wp-admin/js/tags-suggest.js | 24 +++++++++++++++++------- wp-admin/js/tags-suggest.min.js | 2 +- wp-includes/version.php | 2 +- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/wp-admin/js/inline-edit-post.js b/wp-admin/js/inline-edit-post.js index c7d07e6cdf..98fdb6cf32 100644 --- a/wp-admin/js/inline-edit-post.js +++ b/wp-admin/js/inline-edit-post.js @@ -329,6 +329,11 @@ window.wp = window.wp || {}; textarea = $('textarea.tax_input_' + taxname, editRow), comma = wp.i18n._x( ',', 'tag delimiter' ).trim(); + // Ensure the textarea exists. + if ( ! textarea.length ) { + return; + } + terms.find( 'img' ).replaceWith( function() { return this.alt; } ); terms = terms.text(); diff --git a/wp-admin/js/inline-edit-post.min.js b/wp-admin/js/inline-edit-post.min.js index 71bcf2dae3..3d146c8365 100644 --- a/wp-admin/js/inline-edit-post.min.js +++ b/wp-admin/js/inline-edit-post.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -window.wp=window.wp||{},function(h,v){window.inlineEditPost={init:function(){var i=this,t=h("#inline-edit"),e=h("#bulk-edit");i.type=h("table.widefat").hasClass("pages")?"page":"post",i.what="#post-",t.keyup(function(t){if(27===t.which)return inlineEditPost.revert()}),e.keyup(function(t){if(27===t.which)return inlineEditPost.revert()}),h(".cancel",t).click(function(){return inlineEditPost.revert()}),h(".save",t).click(function(){return inlineEditPost.save(this)}),h("td",t).keydown(function(t){if(13===t.which&&!h(t.target).hasClass("cancel"))return inlineEditPost.save(this)}),h(".cancel",e).click(function(){return inlineEditPost.revert()}),h('#inline-edit .inline-edit-private input[value="private"]').click(function(){var t=h("input.inline-edit-password-input");h(this).prop("checked")?t.val("").prop("disabled",!0):t.prop("disabled",!1)}),h("#the-list").on("click",".editinline",function(){h(this).attr("aria-expanded","true"),inlineEditPost.edit(this)}),h("#bulk-edit").find("fieldset:first").after(h("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(h("#inline-edit label.inline-edit-tags").clone()),h('select[name="_status"] option[value="future"]',e).remove(),h("#doaction, #doaction2").click(function(t){var e;i.whichBulkButtonId=h(this).attr("id"),e=i.whichBulkButtonId.substr(2),"edit"===h('select[name="'+e+'"]').val()?(t.preventDefault(),i.setBulk()):0