Commit 1b155cb3 authored by Sascha Grossenbacher's avatar Sascha Grossenbacher Committed by Jacob Rockowitz
Browse files

Issue #3295609 by taniachque, Berdir: [Drupal 9.2.x] Replace jquery.once with new once API

parent 72f780f2
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * Dropbutton feature.
 */

(function ($, Drupal) {
(function ($, Drupal, once) {

  'use strict';

@@ -19,8 +19,8 @@
  Drupal.behaviors.dropButton = {
    attach: function (context, settings) {
      dropButton.attach(context, settings);
      $(context).find('.webform-dropbutton .dropbutton-wrapper').once('webform-dropbutton').css('visibility', 'visible');
      $(once('webform-dropbutton', '.webform-dropbutton .dropbutton-wrapper', context)).css('visibility', 'visible');
    }
  };

})(jQuery, Drupal);
})(jQuery, Drupal, once);
+4 −4
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * JavaScript behaviors for admin pages.
 */

(function ($, Drupal, debounce) {
(function ($, Drupal, debounce, once) {

  'use strict';

@@ -14,7 +14,7 @@
   */
  Drupal.behaviors.webformFilterAutocomplete = {
    attach: function (context) {
      $('.webform-filter-form input.form-autocomplete', context).once('webform-autocomplete')
      $(once('webform-autocomplete', '.webform-filter-form input.form-autocomplete', context))
        .each(function () {
          // If input value is an autocomplete match, reset the input to its
          // default value.
@@ -42,7 +42,7 @@
    attach: function (context) {
      // Only attach the click event handler to the entire table and determine
      // which row triggers the event.
      $('.webform-results-table', context).once('webform-results-table').on('click', function (event) {
      $(once('webform-results-table', '.webform-results-table', context)).on('click', function (event) {
        if (event.target.tagName === 'A' || event.target.tagName === 'BUTTON' || event.target.tagName === 'INPUT') {
          return true;
        }
@@ -70,4 +70,4 @@
    }
  };

})(jQuery, Drupal, Drupal.debounce);
})(jQuery, Drupal, Drupal.debounce, once);
+15 −13
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 * @see misc/dialog/off-canvas.js
 */

(function ($, Drupal) {
(function ($, Drupal, once) {

  'use strict';

@@ -21,7 +21,8 @@
    attach: function () {
      // Resize seven.theme tabs when off-canvas dialog opened and closed.
      // @see core/themes/seven/js/nav-tabs.js
      $(window).once('webform-off-canvas').on({
      if(once('webform-off-canvas', 'html').length) {
        $(window).on({
          'dialog:aftercreate': function (event, dialog, $element, settings) {
            if (Drupal.offCanvas.isOffCanvas($element)) {
              $(window).trigger('resize.tabs');
@@ -34,6 +35,7 @@
          }
        });
      }
    }
  };

  // Append .ckeditor-off-canvas-reset to document to disable ckeditor reset.
@@ -41,4 +43,4 @@
  // @see web/core/modules/ckeditor/js/ckeditor.off-canvas-css-reset.es6.js
  $(document.body).append('<style id="ckeditor-off-canvas-reset"></style>');

})(jQuery, Drupal);
})(jQuery, Drupal, once);
+5 −6
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * JavaScript behaviors for Ajax.
 */

(function ($, Drupal, drupalSettings) {
(function ($, Drupal, drupalSettings, once) {

  'use strict';

@@ -30,7 +30,7 @@
   */
  Drupal.behaviors.webformAjaxLink = {
    attach: function (context) {
      $('.webform-ajax-link', context).once('webform-ajax-link').each(function () {
      $(once('webform-ajax-link', '.webform-ajax-link', context)).each(function () {
        var element_settings = {};
        element_settings.progress = {type: 'fullscreen'};

@@ -71,7 +71,7 @@
   */
  Drupal.behaviors.webformAjaxHash = {
    attach: function (context) {
      $('[data-hash]', context).once('webform-ajax-hash').each(function () {
      $(once('webform-ajax-hash', '[data-hash]', context)).each(function () {
        var hash = $(this).data('hash');
        if (hash) {
          $(this).on('click', function () {
@@ -92,8 +92,7 @@
   */
  Drupal.behaviors.webformConfirmationBackAjax = {
    attach: function (context) {
      $('.js-webform-confirmation-back-link-ajax', context)
        .once('webform-confirmation-back-ajax')
      $(once('webform-confirmation-back-ajax', '.js-webform-confirmation-back-link-ajax', context))
        .on('click', function (event) {
          var $form = $(this).parents('form');

@@ -334,4 +333,4 @@
    }
  };

})(jQuery, Drupal, drupalSettings);
})(jQuery, Drupal, drupalSettings, once);
+3 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * JavaScript behaviors for announcing changes.
 */

(function ($, Drupal) {
(function ($, Drupal, once) {

  'use strict';

@@ -24,10 +24,10 @@
   */
  Drupal.behaviors.webformAnnounce = {
    attach: function (context) {
      $('[data-webform-announce]', context).once('data-webform-announce').each(function () {
      $(once('data-webform-announce', '[data-webform-announce]', context)).each(function () {
        Drupal.announce($(this).data('webform-announce'));
      });
    }
  };

})(jQuery, Drupal);
})(jQuery, Drupal, once);
Loading