summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Loach <robloach@gmail.com>2014-09-26 15:11:31 -0700
committerRob Loach <robloach@gmail.com>2014-09-26 15:11:31 -0700
commitafebd57eb069b8fe4a7a2924ac35116343134138 (patch)
tree77f7e5941981b3909498da4679dc8e451a2c4e99
parent6309f1bebeac39bf8536c7c5f41b7207b9b9c003 (diff)
downloadjquery-once-afebd57eb069b8fe4a7a2924ac35116343134138.zip
jquery-once-afebd57eb069b8fe4a7a2924ac35116343134138.tar.gz
jquery-once-afebd57eb069b8fe4a7a2924ac35116343134138.tar.bz2
Update documentation
-rw-r--r--README.md14
-rw-r--r--jquery.once.js14
2 files changed, 12 insertions, 16 deletions
diff --git a/README.md b/README.md
index aed56c3..5aecd67 100644
--- a/README.md
+++ b/README.md
@@ -14,10 +14,10 @@ $('div.calendar').once('calendar', function() {
// code segment is executed repeatedly.
});
$('div.calendar').once('calendar').click(function() {
- // .once('calendar') filters out all elements which already have the
- // class 'calendar'. It applies that class to the remaining elements
- // and leaves them in the jQuery object.
- // The previous set of elements can be restored with .end()
+ // .once('calendar') filters out all elements which already have been
+ // filtered with once(), and the elements that haven't been filtered
+ // yet remain. The previous set of elements can be restored with
+ // .end().
});
```
@@ -27,8 +27,8 @@ It also works without supplying a name:
$('div.calendar').once(function() {
// This function is only executed once for each div, even if this
// code segment is executed repeatedly. Other scripts can't refer
- // to this `once` method and the class names used are in the form
- // of jquery-once-1 and so on.
+ // to this `once` method. The once data used to store execution are
+ // in the form "jquery-once-1", "jquery-once-2", etc.
});
```
@@ -49,7 +49,7 @@ $ grunt release
License
-------
-Dual licensed under the MIT and GPL licenses.
+Dual licensed under the [MIT and GPL licenses](LICENSE).
Credits
diff --git a/jquery.once.js b/jquery.once.js
index 5784746..5faa4c0 100644
--- a/jquery.once.js
+++ b/jquery.once.js
@@ -24,20 +24,16 @@
* Filters elements by whether they have not yet been processed.
*
* @param id
- * (Optional) If this is a string, then it will be used as the CSS class
- * name that is applied to the elements for determining whether it has
- * already been processed. The elements will get a class in the form of
- * "id-processed".
+ * (Optional) If this is a string, then it will be the data ID used
+ * to determine whether it has already been processed or not.
*
* If the id parameter is a function, it will be passed off to the fn
* parameter and the id will become a unique identifier, represented as a
* number.
*
* When the id is neither a string or a function, it becomes a unique
- * identifier, depicted as a number. The element's class will then be
- * represented in the form of "jquery-once-#-processed".
- *
- * Take note that the id must be valid for usage as an element's class name.
+ * identifier, depicted as a number. The element's data ID will then be
+ * represented in the form of "jquery-once-#".
* @param fn
* (Optional) If given, this function will be called for each element that
* has not yet been processed. The function's return value follows the same
@@ -73,7 +69,7 @@
* Filters elements that have been processed once already.
*
* @param id
- * A required string representing the name of the class which should be used
+ * A required 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.