Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

jQuery each2 initial release

  • Loading branch information...
commit df199e2a6c776a420ea58485522936b3d63d017a 1 parent d0616b6
@cowboy authored
Showing with 36 additions and 0 deletions.
  1. +1 −0  README.markdown
  2. +23 −0 jquery.ba-each2.js
  3. +12 −0 jquery.ba-each2.min.js
View
1  README.markdown
@@ -6,6 +6,7 @@ This repository contains a collection of minor jQuery plugins which are too smal
Visit the [project page](http://benalman.com/projects/jquery-misc-plugins/) for more information and usage examples!
* [jQuery :attached, :detached selectors](http://benalman.com/projects/jquery-misc-plugins/#attached-detached) - Selectors that match elements currently attached to or detached from the DOM.
+* [jQuery each2](http://benalman.com/projects/jquery-misc-plugins/#each2) - If you were going to use `$(this)` inside an `.each` loop, use this plugin instead. It's faster.
* [jQuery getClassData](http://benalman.com/projects/jquery-misc-plugins/#getclassdata) - If you're not yet using HTML 5 data- attributes, you can store basic data in an element's class attribute for easy retrieval.
* [jQuery getUniqueClass](http://benalman.com/projects/jquery-misc-plugins/#getuniqueclass) - For when you really need a unique classname.
* [jQuery isjQuery](http://benalman.com/projects/jquery-misc-plugins/#isjquery) - Determine if an object reference is a jQuery object.
View
23 jquery.ba-each2.js
@@ -0,0 +1,23 @@
+/*!
+ * jQuery each2 - v0.1 - 8/02/2010
+ * http://benalman.com/projects/jquery-misc-plugins/
+ *
+ * Inspired by James Padolsey's quickEach
+ * http://gist.github.com/500145
+ *
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+
+(function($) {
+
+ var jq = $([]);
+
+ $.fn.each2 = function( fn ) {
+ var i = -1;
+ while ( ( jq[0] = this[++i] ) && fn.call( jq[0], i, jq ) !== false ) {}
+ return this;
+ };
+
+})(jQuery);
View
12 jquery.ba-each2.min.js
@@ -0,0 +1,12 @@
+/*
+ * jQuery each2 - v0.1 - 8/02/2010
+ * http://benalman.com/projects/jquery-misc-plugins/
+ *
+ * Inspired by James Padolsey's quickEach
+ * http://gist.github.com/500145
+ *
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+(function(a){var b=a([]);a.fn.each2=function(d){var c=-1;while((b[0]=this[++c])&&d.call(b[0],c,b)!==false){}return this}})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.