Commit 30063228 authored by alexpott's avatar alexpott

Issue #2485605 by ram4nd, iMiksu: Update jquery.once to 2.0.1

parent 3a65c26f
/*!
* jQuery Once v2.0.0 - http://github.com/robloach/jquery-once
* @license MIT, GPL-2.0
* http://opensource.org/licenses/MIT
* http://opensource.org/licenses/GPL-2.0
*/
* jQuery Once v2.0.1 - 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}
*/
* 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") {
......@@ -30,16 +30,16 @@
"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 The valid ID name.
*
* @throws Error when an ID is provided, but not a string.
* @private
*/
* 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 The valid ID name.
*
* @throws Error when an ID is provided, but not a string.
* @private
*/
var checkId = function(id) {
id = id || "once";
if (typeof id !== "string") {
......@@ -49,43 +49,43 @@
};
/**
* 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 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
*/
* 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 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);
......@@ -97,71 +97,71 @@
};
/**
* 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 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
*/
* 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 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 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
*/
* 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 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);
......
/*!
* jQuery Once v2.0.0 - http://github.com/robloach/jquery-once
* jQuery Once v2.0.1 - http://github.com/robloach/jquery-once
* @license MIT, GPL-2.0
* http://opensource.org/licenses/MIT
* http://opensource.org/licenses/GPL-2.0
......
......@@ -384,10 +384,10 @@ jquery.joyride:
jquery.once:
remote: https://github.com/RobLoach/jquery-once
version: "2.0.0"
version: "2.0.1"
license:
name: GNU-GPL-2.0-or-later
url: https://github.com/RobLoach/jquery-once/blob/master/LICENSE.md
url: https://github.com/RobLoach/jquery-once/blob/2.0.1/LICENSE.md
gpl-compatible: true
js:
assets/vendor/jquery-once/jquery.once.min.js: { weight: -19, minified: true }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment