]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#t583] Declare var once
authorrwldrn <waldron.rick@gmail.com>
Fri, 17 Jun 2011 13:51:17 +0000 (09:51 -0400)
committerrwldrn <waldron.rick@gmail.com>
Fri, 17 Jun 2011 13:51:17 +0000 (09:51 -0400)
popcorn.js

index 0032156df00c7412cda28c86b5dbb58999f1de6c..3421a75215f2c60dafe86fa23a75a09e530251df 100644 (file)
     }
 
     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 );
       }