WordPress/wp-admin/js/tags.min.js
davidbaumwald ee85a17cf2 Taxonomy: Consider HTML5 input types when resetting form values after adding a new tag.
When adding a new tag, the form is reset by clearing values for `input[type=text]` and `textarea`s.  However, the reset doesn't account for any HTML5 input types, like `number` or `url`, that may be added by plugins or themes.

This change updates the form resetting jQuery to clear any values from `input` types that are not hidden and neither a `checkbox` nor `radio` type.

Props stevegrunwell.
Fixes #48030.
Built from https://develop.svn.wordpress.org/trunk@52953


git-svn-id: http://core.svn.wordpress.org/trunk@52542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-18 20:12:06 +00:00

2 lines
1.8 KiB
JavaScript

/*! This file is auto-generated */
jQuery(function(o){var r=!1;o("#the-list").on("click",".delete-tag",function(){var t,e=o(this),n=e.parents("tr"),a=!0;return(a="undefined"!=showNotice?showNotice.warn():a)&&(t=e.attr("href").replace(/[^?]*\?/,"").replace(/action=delete/,"action=delete-tag"),o.post(ajaxurl,t,function(e){"1"==e?(o("#ajax-response").empty(),n.fadeOut("normal",function(){n.remove()}),o('select#parent option[value="'+t.match(/tag_ID=(\d+)/)[1]+'"]').remove(),o("a.tag-link-"+t.match(/tag_ID=(\d+)/)[1]).remove()):("-1"==e?o("#ajax-response").empty().append('<div class="error"><p>'+wp.i18n.__("Sorry, you are not allowed to do that.")+"</p></div>"):o("#ajax-response").empty().append('<div class="error"><p>'+wp.i18n.__("Something went wrong.")+"</p></div>"),n.children().css("backgroundColor",""))}),n.children().css("backgroundColor","#f33")),!1}),o("#edittag").on("click",".delete",function(e){return"undefined"==typeof showNotice||void(showNotice.warn()||e.preventDefault())}),o("#submit").on("click",function(){var s=o(this).parents("form");return validateForm(s)&&(r||(r=!0,s.find(".submit .spinner").addClass("is-active"),o.post(ajaxurl,o("#addtag").serialize(),function(e){var t,n,a;if(r=!1,s.find(".submit .spinner").removeClass("is-active"),o("#ajax-response").empty(),(t=wpAjax.parseAjaxResponse(e,"ajax-response"))&&!t.errors){if(0<(e=s.find("select#parent").val())&&0<o("#tag-"+e).length?o(".tags #tag-"+e).after(t.responses[0].supplemental.noparents):o(".tags").prepend(t.responses[0].supplemental.parents),o(".tags .no-items").remove(),s.find("select#parent")){for(e=t.responses[1].supplemental,n="",a=0;a<t.responses[1].position;a++)n+="&nbsp;&nbsp;&nbsp;";s.find("select#parent option:selected").after('<option value="'+e.term_id+'">'+n+e.name+"</option>")}o('input:not([type="checkbox"]):not([type="radio"]):visible, textarea:visible',s).val("")}}))),!1})});