Verified Commit c4c4de21 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3492582 by tom konda, zaryab_drupal, nod_, smustgrave: Replace some of...

Issue #3492582 by tom konda, zaryab_drupal, nod_, smustgrave: Replace some of obj && obj.prop with optional chaining
parent 7afad30a
Loading
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -456,7 +456,7 @@

    // If there isn't a form, jQuery.ajax() will be used instead, allowing us to
    // bind Ajax to links as well.
    if (this.element && this.element.form) {
    if (this.element?.form) {
      /**
       * @type {jQuery}
       */
@@ -1038,7 +1038,7 @@
      (executionQueue, key) =>
        executionQueue.then(() => {
          const { command } = response[key];
          if (command && ajaxCommands[command]) {
          if (ajaxCommands?.[command]) {
            // When a command returns a promise, the remaining commands will not
            // execute until that promise has been fulfilled. This is typically
            // used to ensure JavaScript files added via the 'add_js' command
@@ -1894,10 +1894,9 @@
      xhr.getResponseHeader('X-Drupal-Ajax-Token') === '1' &&
      // The isInProgress() function might not be defined if the Ajax request
      // was initiated without Drupal.ajax() or new Drupal.Ajax().
      settings.isInProgress &&
      // Until this is false, the Ajax request isn't completely done (the
      // response's commands might still be running).
      settings.isInProgress()
      settings?.isInProgress()
    );
  };
  $.extend(true, $.event.special, {
+1 −5
Original line number Diff line number Diff line
@@ -142,11 +142,7 @@
        }
        // Skip processing upon a form validation error on a non-empty
        // machine name.
        if (
          $target.hasClass('error') &&
          $target[0].value &&
          $target[0].value.trim().length
        ) {
        if ($target.hasClass('error') && $target[0].value?.trim().length) {
          return;
        }
        // Figure out the maximum length for the machine name.
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −5
Original line number Diff line number Diff line
@@ -99,11 +99,7 @@ export default class DrupalImageUploadAdapter {
      const response = xhr.response;

      if (!response || response.error) {
        return reject(
          response && response.error && response.error.message
            ? response.error.message
            : genericErrorText,
        );
        return reject(response?.error?.message || genericErrorText);
      }
      // Resolve with the `urls` property and pass the response
      // to allow customizing the behavior of features relying on the upload adapters.
Loading