Unverified Commit 7362987e authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3268550 by longwave, Spokje: Remove deprecated jquery-once

parent 801e645e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -45,8 +45,6 @@ JavaScript
  jQuery Metadata - Copyright (c) 2006 John Resig, Yehuda Katz, Jörn Zaefferer,
    Paul McLanahan

  jQuery Once - Copyright (c) 2009 Konstantin Käfer

  jQuery UI - Copyright (c) 2015 by the authors and other contributors
    (http://jqueryui.com/about)

+0 −177
Original line number Diff line number Diff line
/*!
 * jQuery Once v2.2.3 - http://github.com/robloach/jquery-once
 * @license MIT, GPL-2.0
 *   http://opensource.org/licenses/MIT
 *   http://opensource.org/licenses/GPL-2.0
 */

/**
 * Universal Module Definition
 *
 * jQuery Once has a dependency on jQuery, so we wrap the code with a UMD
 * pattern in order to allow loading jQuery and jQuery Once through a module
 * definition like CommonJS, AMD, or through a global object.
 *
 * @see {@link http://github.com/umdjs/umd}
 */
(function (factory) {
  'use strict';

  if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
    // CommonJS
    factory(require('jquery'));
  } else if (typeof define === 'function' && define.amd) {
    // AMD
    /* globals define */
    define(['jquery'], factory);
  } else {
    // Global object
    /* globals jQuery */
    factory(jQuery);
  }
})(function ($) {
  'use strict';

  /**
   * Ensures that the given ID is valid, returning 'once' if one is not given.
   *
   * @param {string} [id=once]
   *   A string representing the ID to check. Defaults to `'once'`.
   *
   * @returns {number} The valid ID name.
   *
   * @throws TypeError when an ID is provided, but not a string.
   * @private
   */
  var checkId = function (id) {
    id = id || 'once';
    if (typeof id !== 'string') {
      throw new TypeError('The jQuery Once id parameter must be a string');
    }

    return id;
  };

  /**
   * Filter elements that have yet to be processed by the given data ID.
   *
   * @param {string} [id=once]
   *   The data ID used to determine whether the given elements have already
   *   been processed or not. Defaults to `'once'`.
   *
   * @returns {jQuery} jQuery collection of elements that have now run once by
   *   the given ID.
   *
   * @example
   * ``` javascript
   * // The following will change the color of each paragraph to red, just once
   * // for the 'changecolor' key.
   * $('p').once('changecolor').css('color', 'red');
   *
   * // .once() will return a set of elements that yet to have the once ID
   * // associated with them. You can return to the original collection set by
   * // using .end().
   * $('p')
   *   .once('changecolorblue')
   *     .css('color', 'blue')
   *   .end()
   *   .css('color', 'red');
   *
   * // To execute a function on the once set, you can use jQuery's each().
   * $('div.calendar').once().each(function () {
   *   // Since there is no once ID provided here, the key will be 'once'.
   * });
   * ```
   *
   * @see removeOnce
   * @see findOnce
   * @this jQuery
   *
   * @global
   * @public
   */
  $.fn.once = function (id) {
    // Build the jQuery Once data name from the provided ID.
    var name = 'jquery-once-' + checkId(id);

    // Find elements that don't have the jQuery Once data applied to them yet.
    return this.filter(function () {
      return $(this).data(name) !== true;
    }).data(name, true);
  };

  /**
   * Removes the once data from elements, based on the given ID.
   *
   * @param {string} [id=once]
   *   A string representing the name of the data ID which should be used when
   *   filtering the elements. This only filters elements that have already been
   *   processed by the once function. The ID should be the same ID that was
   *   originally passed to the once() function. Defaults to `'once'`.
   *
   * @returns {jQuery} jQuery collection of elements that were acted upon to remove their
   *    once data.
   *
   * @example
   * ``` javascript
   * // Remove once data with the 'changecolor' ID. The result set is the
   * // elements that had their once data removed.
   * $('p').removeOnce('changecolor').css('color', '');
   *
   * // Any jQuery function can be performed on the result set.
   * $('div.calendar').removeOnce().each(function () {
   *   // Remove the calendar behavior.
   * });
   * ```
   *
   * @see once
   * @this jQuery
   *
   * @global
   * @public
   */
  $.fn.removeOnce = function (id) {
    // Filter through the elements to find the once'd elements.
    return this.findOnce(id).removeData('jquery-once-' + checkId(id));
  };

  /**
   * Filters elements that have already been processed once.
   *
   * @param {string} [id=once]
   *   A string representing the name of the data id which should be used when
   *   filtering the elements. This only filters elements that have already
   *   been processed by the once function. The id should be the same id that
   *   was originally passed to the once() function. Defaults to 'once'.
   *
   * @returns {jQuery} jQuery collection of elements that have been run once.
   *
   * @example
   * ``` javascript
   * // Find all elements that have been changecolor'ed once.
   * $('p').findOnce('changecolor').each(function () {
   *   // This function is called for all elements that has already once'd.
   * });
   *
   * // Find all elements that have been acted on with the default 'once' key.
   * $('p').findOnce().each(function () {
   *   // This function is called for all elements that have been acted on with
   *   // a 'once' action.
   * });
   * ```
   *
   * @see once
   * @this jQuery
   *
   * @global
   * @public
   */
  $.fn.findOnce = function (id) {
    // Filter the elements by which do have the data.
    var name = 'jquery-once-' + checkId(id);

    return this.filter(function () {
      return $(this).data(name) === true;
    });
  };
});
+0 −8
Original line number Diff line number Diff line
/*!
 * jQuery Once v2.2.3 - http://github.com/robloach/jquery-once
 * @license MIT, GPL-2.0
 *   http://opensource.org/licenses/MIT
 *   http://opensource.org/licenses/GPL-2.0
 */
(function(e){"use strict";if(typeof exports==="object"&&typeof exports.nodeName!=="string"){e(require("jquery"))}else if(typeof define==="function"&&define.amd){define(["jquery"],e)}else{e(jQuery)}})(function(t){"use strict";var r=function(e){e=e||"once";if(typeof e!=="string"){throw new TypeError("The jQuery Once id parameter must be a string")}return e};t.fn.once=function(e){var n="jquery-once-"+r(e);return this.filter(function(){return t(this).data(n)!==true}).data(n,true)};t.fn.removeOnce=function(e){return this.findOnce(e).removeData("jquery-once-"+r(e))};t.fn.findOnce=function(e){var n="jquery-once-"+r(e);return this.filter(function(){return t(this).data(n)===true})}});
//# sourceMappingURL=jquery.once.min.js.map
 No newline at end of file
+0 −1
Original line number Diff line number Diff line
{"version":3,"sources":["jquery.once.js"],"names":["factory","exports","nodeName","require","define","amd","jQuery","$","checkId","id","TypeError","fn","once","name","this","filter","data","removeOnce","findOnce","removeData"],"mappings":";;;;;;CAgBA,SAAWA,GACT,aAEA,UAAWC,UAAY,iBAAmBA,QAAQC,WAAa,SAAU,CAEvEF,EAAQG,QAAQ,gBACX,UAAWC,SAAW,YAAcA,OAAOC,IAAK,CAGrDD,OAAO,CAAC,UAAWJ,OACd,CAGLA,EAAQM,UAbZ,CAeG,SAAUC,GACX,aAaA,IAAIC,EAAU,SAAUC,GACtBA,EAAKA,GAAM,OACX,UAAWA,IAAO,SAAU,CAC1B,MAAM,IAAIC,UAAU,iDAGtB,OAAOD,GAyCTF,EAAEI,GAAGC,KAAO,SAAUH,GAEpB,IAAII,EAAO,eAAiBL,EAAQC,GAGpC,OAAOK,KAAKC,OAAO,WACjB,OAAOR,EAAEO,MAAME,KAAKH,KAAU,OAC7BG,KAAKH,EAAM,OAiChBN,EAAEI,GAAGM,WAAa,SAAUR,GAE1B,OAAOK,KAAKI,SAAST,GAAIU,WAAW,eAAiBX,EAAQC,KAkC/DF,EAAEI,GAAGO,SAAW,SAAUT,GAExB,IAAII,EAAO,eAAiBL,EAAQC,GAEpC,OAAOK,KAAKC,OAAO,WACjB,OAAOR,EAAEO,MAAME,KAAKH,KAAU","file":"jquery.once.min.js"}
 No newline at end of file
+0 −41
Original line number Diff line number Diff line
@@ -357,7 +357,6 @@ drupal.ajax:
    - core/drupal.nodelist.foreach
    - core/drupal.progress
    - core/once
    - core/jquery.once.bc
    - core/tabbable

drupal.announce:
@@ -442,7 +441,6 @@ drupal.batch:
    - core/drupal.ajax
    - core/drupal.progress
    - core/once
    - core/jquery.once.bc

drupal.checkbox:
  version: VERSION
@@ -463,7 +461,6 @@ drupal.collapse:
    - core/drupal
    - core/drupal.form
    - core/once
    - core/jquery.once.bc

drupal.customevent:
  version: VERSION
@@ -574,7 +571,6 @@ drupal.dropbutton:
    - core/drupal
    - core/drupalSettings
    - core/once
    - core/jquery.once.bc

drupal.element.closest:
  version: VERSION
@@ -604,7 +600,6 @@ drupal.form:
    - core/drupal
    - core/drupal.debounce
    - core/once
    - core/jquery.once.bc

drupal.machine-name:
  version: VERSION
@@ -613,7 +608,6 @@ drupal.machine-name:
  dependencies:
    - core/jquery
    - core/once
    - core/jquery.once.bc
    - core/drupal
    - core/drupalSettings
    - core/drupal.form
@@ -654,7 +648,6 @@ drupal.states:
    - core/drupal
    - core/drupalSettings
    - core/once
    - core/jquery.once.bc

drupal.string.includes:
  version: VERSION
@@ -679,7 +672,6 @@ drupal.tabledrag:
    - core/drupal
    - core/drupalSettings
    - core/once
    - core/jquery.once.bc

drupal.tableheader:
  version: VERSION
@@ -690,7 +682,6 @@ drupal.tableheader:
    - core/drupal
    - core/drupalSettings
    - core/once
    - core/jquery.once.bc
    - core/drupal.displace

drupal.tableresponsive:
@@ -701,7 +692,6 @@ drupal.tableresponsive:
    - core/jquery
    - core/drupal
    - core/once
    - core/jquery.once.bc

drupal.tableselect:
  version: VERSION
@@ -712,7 +702,6 @@ drupal.tableselect:
    - core/drupal.checkbox
    - core/jquery
    - core/once
    - core/jquery.once.bc

drupal.timezone:
  version: VERSION
@@ -722,7 +711,6 @@ drupal.timezone:
    - core/drupal.nodelist.foreach
    - core/jquery
    - core/once
    - core/jquery.once.bc
    - core/drupal

drupal.vertical-tabs:
@@ -736,7 +724,6 @@ drupal.vertical-tabs:
  dependencies:
    - core/jquery
    - core/once
    - core/jquery.once.bc
    - core/drupal
    - core/drupalSettings
    - core/drupal.form
@@ -808,33 +795,6 @@ shepherd:
  js:
    assets/vendor/shepherd/shepherd.min.js: { minified: true }

jquery.once:
  remote: https://github.com/RobLoach/jquery-once
  version: "2.2.3"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/RobLoach/jquery-once/2.2.3/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/jquery-once/jquery.once.min.js: { weight: -19, minified: true }
  dependencies:
    - core/jquery
    - core/jquery.once.bc
  deprecated: The %library_id% asset library is deprecated in Drupal 9.3.0 and will be removed in Drupal 10.0.0. Use the core/once library instead. See https://www.drupal.org/node/3158256

# Internal library, do not depend on it.
# The library will be removed in Drupal 10.0.0.
jquery.once.bc:
  version: VERSION
  js:
    assets/vendor/jquery-once/jquery.once.min.js: { weight: -19, minified: true }
    misc/jquery.once.bc.js: {}
  dependencies:
    - core/drupal
    - core/jquery
    - core/once
    - core/drupal.object.assign

jquery.ui:
  version: &jquery_ui_version "1.13.1"
  license: &jquery_ui_license
@@ -1144,7 +1104,6 @@ drupal.dialog.off_canvas:
  dependencies:
    - core/jquery
    - core/once
    - core/jquery.once.bc
    - core/drupal
    - core/drupal.ajax
    - core/drupal.announce
Loading