Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fafbd49

Browse files
committed
perf(jqLite): microoptimization in chaining fn
note: no siginificant difference observed in macrobenchmarks, so this is just to make me feel better :)
1 parent bda673f commit fafbd49

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/jqLite.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,9 @@ forEach({
930930
*/
931931
JQLite.prototype[name] = function(arg1, arg2, arg3) {
932932
var value;
933-
for(var i=0; i < this.length; i++) {
933+
var nodeCount = this.length;
934+
935+
for(var i=0; i < nodeCount; i++) {
934936
if (isUndefined(value)) {
935937
value = fn(this[i], arg1, arg2, arg3);
936938
if (isDefined(value)) {

0 commit comments

Comments
 (0)