Coding Standards: Add missing braces to if conditions in js/_enqueues/wp/util.js.

Props ankitmaru.
Fixes #48980.

git-svn-id: https://develop.svn.wordpress.org/trunk@46960 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-12-15 08:43:42 +00:00
parent b202cb423a
commit 49c6bc2a69

View File

@ -94,10 +94,13 @@ window.wp = window.wp || {};
deferred = $.Deferred( function( deferred ) { deferred = $.Deferred( function( deferred ) {
// Transfer success/error callbacks. // Transfer success/error callbacks.
if ( options.success ) if ( options.success ) {
deferred.done( options.success ); deferred.done( options.success );
if ( options.error ) }
if ( options.error ) {
deferred.fail( options.error ); deferred.fail( options.error );
}
delete options.success; delete options.success;
delete options.error; delete options.error;
@ -105,13 +108,15 @@ window.wp = window.wp || {};
// Use with PHP's wp_send_json_success() and wp_send_json_error() // Use with PHP's wp_send_json_success() and wp_send_json_error()
deferred.jqXHR = $.ajax( options ).done( function( response ) { deferred.jqXHR = $.ajax( options ).done( function( response ) {
// Treat a response of 1 as successful for backward compatibility with existing handlers. // Treat a response of 1 as successful for backward compatibility with existing handlers.
if ( response === '1' || response === 1 ) if ( response === '1' || response === 1 ) {
response = { success: true }; response = { success: true };
}
if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) {
deferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [response.data] ); deferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [response.data] );
else } else {
deferred.rejectWith( this, [response] ); deferred.rejectWith( this, [response] );
}
}).fail( function() { }).fail( function() {
deferred.rejectWith( this, arguments ); deferred.rejectWith( this, arguments );
}); });