Make WordPress Core

Changeset 46960


Ignore:
Timestamp:
12/15/2019 08:43:42 AM (7 years ago)
Author:
SergeyBiryukov
Message:

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

Props ankitmaru.
Fixes #48980.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/util.js

    r43347 r46960  
    9595                        deferred = $.Deferred( function( deferred ) {
    9696                                // Transfer success/error callbacks.
    97                                 if ( options.success )
     97                                if ( options.success ) {
    9898                                        deferred.done( options.success );
    99                                 if ( options.error )
     99                                }
     100
     101                                if ( options.error ) {
    100102                                        deferred.fail( options.error );
     103                                }
    101104
    102105                                delete options.success;
     
    106109                                deferred.jqXHR = $.ajax( options ).done( function( response ) {
    107110                                        // Treat a response of 1 as successful for backward compatibility with existing handlers.
    108                                         if ( response === '1' || response === 1 )
     111                                        if ( response === '1' || response === 1 ) {
    109112                                                response = { success: true };
     113                                        }
    110114
    111                                         if ( _.isObject( response ) && ! _.isUndefined( response.success ) )
     115                                        if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) {
    112116                                                deferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [response.data] );
    113                                         else
     117                                        } else {
    114118                                                deferred.rejectWith( this, [response] );
     119                                        }
    115120                                }).fail( function() {
    116121                                        deferred.rejectWith( this, arguments );
Note: See TracChangeset for help on using the changeset viewer.