From 32efb955d0e4bac598d9c4766e7b1020afe7edb6 Mon Sep 17 00:00:00 2001 From: rwldrn Date: Fri, 17 Jun 2011 09:51:17 -0400 Subject: [PATCH] [#t583] Declare var once --- popcorn.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/popcorn.js b/popcorn.js index 0032156..3421a75 100644 --- a/popcorn.js +++ b/popcorn.js @@ -311,19 +311,22 @@ } context = context || this; + + var key; + // Use native whenever possible if ( forEach && obj.forEach === forEach ) { return obj.forEach( fn, context ); } if ( toString.call( obj ) === "[object NodeList]" ) { - for ( var key = 0, len = obj.length; key < len; key++ ) { + for ( key = 0, len = obj.length; key < len; key++ ) { fn.call( context, obj[ key ], key, obj ); } return obj; } - for ( var key in obj ) { + for ( key in obj ) { if ( hasOwn.call( obj, key ) ) { fn.call( context, obj[ key ], key, obj ); } -- 2.43.0