Coding Standards: Use strict comparison in `js/_enqueues/lib/ajax-response.js`.
Props ankitmaru. Fixes #50320. Built from https://develop.svn.wordpress.org/trunk@48040 git-svn-id: http://core.svn.wordpress.org/trunk@47807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
01eb2907a7
commit
d776a4d15e
|
@ -20,7 +20,7 @@ window.wpAjax = jQuery.extend( {
|
||||||
parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission.
|
parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission.
|
||||||
var parsed = {}, re = jQuery('#' + r).empty(), err = '';
|
var parsed = {}, re = jQuery('#' + r).empty(), err = '';
|
||||||
|
|
||||||
if ( x && typeof x == 'object' && x.getElementsByTagName('wp_ajax') ) {
|
if ( x && typeof x === 'object' && x.getElementsByTagName('wp_ajax') ) {
|
||||||
parsed.responses = [];
|
parsed.responses = [];
|
||||||
parsed.errors = false;
|
parsed.errors = false;
|
||||||
jQuery('response', x).each( function() {
|
jQuery('response', x).each( function() {
|
||||||
|
@ -51,7 +51,7 @@ window.wpAjax = jQuery.extend( {
|
||||||
}
|
}
|
||||||
if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); }
|
if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); }
|
||||||
x = parseInt(x,10);
|
x = parseInt(x,10);
|
||||||
if ( -1 == x ) { return !re.html('<div class="error"><p>' + wpAjax.noPerm + '</p></div>'); }
|
if ( -1 === x ) { return !re.html('<div class="error"><p>' + wpAjax.noPerm + '</p></div>'); }
|
||||||
else if ( 0 === x ) { return !re.html('<div class="error"><p>' + wpAjax.broken + '</p></div>'); }
|
else if ( 0 === x ) { return !re.html('<div class="error"><p>' + wpAjax.broken + '</p></div>'); }
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
/*! This file is auto-generated */
|
/*! This file is auto-generated */
|
||||||
window.wpAjax=jQuery.extend({unserialize:function(e){var r,t,i,n,a={};if(!e)return a;for(i in(r=e.split("?"))[1]&&(e=r[1]),t=e.split("&"))jQuery.isFunction(t.hasOwnProperty)&&!t.hasOwnProperty(i)||(a[(n=t[i].split("="))[0]]=n[1]);return a},parseAjaxResponse:function(a,e,o){var s={},r=jQuery("#"+e).empty(),u="";return a&&"object"==typeof a&&a.getElementsByTagName("wp_ajax")?(s.responses=[],s.errors=!1,jQuery("response",a).each(function(){var n,e=jQuery(this),r=jQuery(this.firstChild);(n={action:e.attr("action"),what:r.get(0).nodeName,id:r.attr("id"),oldId:r.attr("old_id"),position:r.attr("position")}).data=jQuery("response_data",r).text(),n.supplemental={},jQuery("supplemental",r).children().each(function(){n.supplemental[this.nodeName]=jQuery(this).text()}).length||(n.supplemental=!1),n.errors=[],jQuery("wp_error",r).each(function(){var e,r,t,i=jQuery(this).attr("code");e={code:i,message:this.firstChild.nodeValue,data:!1},(r=jQuery('wp_error_data[code="'+i+'"]',a))&&(e.data=r.get()),(t=jQuery("form-field",r).text())&&(i=t),o&&wpAjax.invalidateForm(jQuery("#"+o+' :input[name="'+i+'"]').parents(".form-field:first")),u+="<p>"+e.message+"</p>",n.errors.push(e),s.errors=!0}).length||(n.errors=!1),s.responses.push(n)}),u.length&&r.html('<div class="error">'+u+"</div>"),s):isNaN(a)?!r.html('<div class="error"><p>'+a+"</p></div>"):-1==(a=parseInt(a,10))?!r.html('<div class="error"><p>'+wpAjax.noPerm+"</p></div>"):0!==a||!r.html('<div class="error"><p>'+wpAjax.broken+"</p></div>")},invalidateForm:function(e){return jQuery(e).addClass("form-invalid").find("input").one("change wp-check-valid-field",function(){jQuery(this).closest(".form-invalid").removeClass("form-invalid")})},validateForm:function(e){return e=jQuery(e),!wpAjax.invalidateForm(e.find(".form-required").filter(function(){return""===jQuery("input:visible",this).val()})).length}},wpAjax||{noPerm:"Sorry, you are not allowed to do that.",broken:"Something went wrong."}),jQuery(document).ready(function(e){e("form.validate").submit(function(){return wpAjax.validateForm(e(this))})});
|
window.wpAjax=jQuery.extend({unserialize:function(e){var r,t,i,n,a={};if(!e)return a;for(i in(r=e.split("?"))[1]&&(e=r[1]),t=e.split("&"))jQuery.isFunction(t.hasOwnProperty)&&!t.hasOwnProperty(i)||(a[(n=t[i].split("="))[0]]=n[1]);return a},parseAjaxResponse:function(a,e,o){var s={},r=jQuery("#"+e).empty(),u="";return a&&"object"==typeof a&&a.getElementsByTagName("wp_ajax")?(s.responses=[],s.errors=!1,jQuery("response",a).each(function(){var n,e=jQuery(this),r=jQuery(this.firstChild);(n={action:e.attr("action"),what:r.get(0).nodeName,id:r.attr("id"),oldId:r.attr("old_id"),position:r.attr("position")}).data=jQuery("response_data",r).text(),n.supplemental={},jQuery("supplemental",r).children().each(function(){n.supplemental[this.nodeName]=jQuery(this).text()}).length||(n.supplemental=!1),n.errors=[],jQuery("wp_error",r).each(function(){var e,r,t,i=jQuery(this).attr("code");e={code:i,message:this.firstChild.nodeValue,data:!1},(r=jQuery('wp_error_data[code="'+i+'"]',a))&&(e.data=r.get()),(t=jQuery("form-field",r).text())&&(i=t),o&&wpAjax.invalidateForm(jQuery("#"+o+' :input[name="'+i+'"]').parents(".form-field:first")),u+="<p>"+e.message+"</p>",n.errors.push(e),s.errors=!0}).length||(n.errors=!1),s.responses.push(n)}),u.length&&r.html('<div class="error">'+u+"</div>"),s):isNaN(a)?!r.html('<div class="error"><p>'+a+"</p></div>"):-1===(a=parseInt(a,10))?!r.html('<div class="error"><p>'+wpAjax.noPerm+"</p></div>"):0!==a||!r.html('<div class="error"><p>'+wpAjax.broken+"</p></div>")},invalidateForm:function(e){return jQuery(e).addClass("form-invalid").find("input").one("change wp-check-valid-field",function(){jQuery(this).closest(".form-invalid").removeClass("form-invalid")})},validateForm:function(e){return e=jQuery(e),!wpAjax.invalidateForm(e.find(".form-required").filter(function(){return""===jQuery("input:visible",this).val()})).length}},wpAjax||{noPerm:"Sorry, you are not allowed to do that.",broken:"Something went wrong."}),jQuery(document).ready(function(e){e("form.validate").submit(function(){return wpAjax.validateForm(e(this))})});
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-48039';
|
$wp_version = '5.5-alpha-48040';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue