summaryrefslogtreecommitdiffstats
path: root/jquery.once.js
diff options
context:
space:
mode:
authorRob Loach <robloach@gmail.com>2013-05-18 16:53:24 -0400
committerRob Loach <robloach@gmail.com>2013-05-18 16:53:24 -0400
commitae58c4e0e6833c784706a2b6b46825fef9d85452 (patch)
treeb8b238d8e9cf03f6321ec163f66f33c15039bb6a /jquery.once.js
parente7e38de3eb78a612c876bb909f208856f401f21f (diff)
downloadjquery-once-ae58c4e0e6833c784706a2b6b46825fef9d85452.zip
jquery-once-ae58c4e0e6833c784706a2b6b46825fef9d85452.tar.gz
jquery-once-ae58c4e0e6833c784706a2b6b46825fef9d85452.tar.bz2
Add UMD, Bower support, tag 1.2.11.2.1
Diffstat (limited to 'jquery.once.js')
-rw-r--r--jquery.once.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/jquery.once.js b/jquery.once.js
index 21c82c2..75a074c 100644
--- a/jquery.once.js
+++ b/jquery.once.js
@@ -1,5 +1,5 @@
/**
- * jQuery Once Plugin v1.2
+ * jQuery Once Plugin v1.2.1
* http://plugins.jquery.com/project/once
*
* Dual licensed under the MIT and GPL licenses:
@@ -7,7 +7,17 @@
* http://www.gnu.org/licenses/gpl.html
*/
-(function ($) {
+(function (factory) {
+ 'use strict';
+ if (typeof exports === 'object') {
+ factory(require('jquery'));
+ } else if (typeof define === 'function' && define.amd) {
+ define(['jquery'], factory);
+ } else {
+ factory(jQuery);
+ }
+}(function ($) {
+ 'use strict';
var cache = {}, uuid = 0;
/**
@@ -36,7 +46,7 @@
* iteration.
*/
$.fn.once = function (id, fn) {
- if (typeof id != 'string') {
+ if (typeof id !== 'string') {
// Generate a numeric ID if the id passed can't be used as a CSS class.
if (!(id in cache)) {
cache[id] = ++uuid;
@@ -75,4 +85,4 @@
return $.isFunction(fn) ? elements.each(fn) : elements;
};
-})(jQuery);
+}));