From: rwldrn Date: Fri, 17 Jun 2011 13:51:17 +0000 (-0400) Subject: [#t583] Declare var once X-Git-Tag: v0.7^2~34^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=32efb955d0e4bac598d9c4766e7b1020afe7edb6;p=popcorn-js.git [#t583] Declare var once --- 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 ); }