summaryrefslogtreecommitdiffstats
path: root/jquery.once.js
diff options
context:
space:
mode:
authorRob Loach <robloach@gmail.com>2014-10-07 14:09:51 -0400
committerRob Loach <robloach@gmail.com>2014-10-07 14:09:51 -0400
commita13bee763493c608722ea4ff53269fecb8b6d68b (patch)
tree77a13a2452bb46423d9dd6bca4a15c4170334264 /jquery.once.js
parent80d3a483234a1969f5e44882e4fa26489dd79910 (diff)
downloadjquery-once-a13bee763493c608722ea4ff53269fecb8b6d68b.zip
jquery-once-a13bee763493c608722ea4ff53269fecb8b6d68b.tar.gz
jquery-once-a13bee763493c608722ea4ff53269fecb8b6d68b.tar.bz2
Update documentation
Diffstat (limited to 'jquery.once.js')
-rw-r--r--jquery.once.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/jquery.once.js b/jquery.once.js
index 222aef4..054ceb4 100644
--- a/jquery.once.js
+++ b/jquery.once.js
@@ -21,16 +21,17 @@
var cache = {}, uuid = 0;
/**
- * Filters elements by whether they have not yet been processed.
+ * Filter elements by whether they have not yet been processed.
*
* @param {string} [id]
- * (Optional) If this is a string, then it will be the data ID used
- * to determine whether it has already been processed or not.
+ * (Optional) The data id used to determine whether the given elements have
+ * already been processed or not.
*
- * When the id is not passed, it becomes a unique identifier, depicted as a
- * number. The element's data ID will then be represented in the form of
+ * When id is not provided, it becomes a unique identifier, depicted as a
+ * number. The element's data id will then be represented in the form of
* "jquery-once-#".
- * @returns jQuery element collection of elements that have now run once.
+ * @returns jQuery element collection of elements that have now run once by
+ * the given id.
*
* @example
* // Change the color to green only once.
@@ -112,6 +113,7 @@
$.fn.findOnce = function (id) {
// Filter the elements by which do have the data.
var name = 'jquery-once-' + id;
+
return this.filter(function() {
return $(this).data(name) === true;
});