Index: src/wp-includes/class.wp-dependencies.php
===================================================================
--- src/wp-includes/class.wp-dependencies.php	(revision 36589)
+++ src/wp-includes/class.wp-dependencies.php	(working copy)
@@ -100,14 +100,12 @@
 			if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
 				/*
 				 * Attempt to process the item. If successful,
-				 * add the handle to the done array.
-				 *
-				 * Unset the item from the to_do array.
+				 * add the handle to the done array and unset the item from the to_do array.
 				 */
-				if ( $this->do_item( $handle, $group ) )
+				if ( $this->do_item( $handle, $group ) ) {
 					$this->done[] = $handle;
-
-				unset( $this->to_do[$key] );
+					unset( $this->to_do[$key] );
+				}
 			}
 		}
 
@@ -385,7 +383,7 @@
 		$group = (int) $group;
 
 		if ( $recursion )
-			$group = min($this->group, $group);
+			$this->group = $group = min($this->group, $group);
 		else
 			$this->group = $group;
 
