Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1211
diff -u -p -r1.1211 common.inc
--- includes/common.inc	27 Aug 2010 11:54:32 -0000	1.1211
+++ includes/common.inc	31 Aug 2010 19:29:36 -0000
@@ -5793,7 +5793,7 @@ function drupal_common_theme() {
       'variables' => array('type' => MARK_NEW),
     ),
     'item_list' => array(
-      'variables' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => array()),
+      'variables' => array('items' => array(), 'title' => '', 'type' => 'ul', 'attributes' => array()),
     ),
     'more_help_link' => array(
       'variables' => array('url' => NULL),
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.606
diff -u -p -r1.606 theme.inc
--- includes/theme.inc	22 Aug 2010 12:46:21 -0000	1.606
+++ includes/theme.inc	31 Aug 2010 19:41:40 -0000
@@ -1793,12 +1793,12 @@ function theme_mark($variables) {
  *
  * @param $variables
  *   An associative array containing:
- *   - items: An array of items to be displayed in the list. If an item is a
- *     string, then it is used as is. If an item is an array, then the "data"
- *     element of the array is used as the contents of the list item. If an item
- *     is an array with a "children" element, those children are displayed in a
- *     nested list. All other elements are treated as attributes of the list
- *     item element.
+ *   - items: A list of items to render. String values are rendered as is. Each
+ *     item can also be an associative array containing:
+ *     - data: The string content of the list item.
+ *     - children: A list of nested child items to render.
+ *     - ...: All other key/value pairs are used as HTML attributes for the list
+ *       item and derived to nested child items, if any.
  *   - title: The title of the list.
  *   - type: The type of list to return (e.g. "ul", "ol").
  *   - attributes: The attributes applied to the list element.
@@ -1807,50 +1807,55 @@ function theme_item_list($variables) {
   $items = $variables['items'];
   $title = $variables['title'];
   $type = $variables['type'];
-  $attributes = $variables['attributes'];
+  $list_attributes = $variables['attributes'];
 
   $output = '<div class="item-list">';
-  if (isset($title)) {
+  if ($title !== '') {
     $output .= '<h3>' . $title . '</h3>';
   }
 
-  if (!empty($items)) {
-    $output .= "<$type" . drupal_attributes($attributes) . '>';
+  if ($items) {
+    $output .= '<' . $type . drupal_attributes($list_attributes) . '>';
+
     $num_items = count($items);
-    foreach ($items as $i => $item) {
+    $i = 0;
+    foreach ($items as $item) {
+      $i++;
       $attributes = array();
-      $children = array();
+
       if (is_array($item)) {
-        foreach ($item as $key => $value) {
-          if ($key == 'data') {
-            $data = $value;
-          }
-          elseif ($key == 'children') {
-            $children = $value;
-          }
-          else {
-            $attributes[$key] = $value;
-          }
+        $value = '';
+        if (isset($item['data'])) {
+          $value .= $item['data'];
+        }
+        $attributes = array_diff_key($item, array('data' => 0, 'children' => 0));
+        // Append nested child list, if any.
+        if (isset($item['children'])) {
+          $value .= theme('item_list', array(
+            'items' => $item['children'],
+            'type' => $type,
+            'attributes' => $attributes,
+          ));
         }
       }
       else {
-        $data = $item;
-      }
-      if (count($children) > 0) {
-        // Render nested list.
-        $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
+        $value = $item;
       }
-      if ($i == 0) {
+
+      $attributes['class'][] = ($i % 2 ? 'odd' : 'even');
+      if ($i == 1) {
         $attributes['class'][] = 'first';
       }
-      if ($i == $num_items - 1) {
+      if ($i == $num_items) {
         $attributes['class'][] = 'last';
       }
-      $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
+
+      $output .= '<li' . drupal_attributes($attributes) . '>' . $value . '</li>';
     }
     $output .= "</$type>";
   }
   $output .= '</div>';
+
   return $output;
 }
 
Index: modules/simpletest/tests/theme.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/theme.test,v
retrieving revision 1.20
diff -u -p -r1.20 theme.test
--- modules/simpletest/tests/theme.test	22 Aug 2010 12:46:21 -0000	1.20
+++ modules/simpletest/tests/theme.test	31 Aug 2010 19:43:39 -0000
@@ -139,7 +139,7 @@ class ThemeTableUnitTest extends DrupalW
 /**
  * Unit tests for theme_item_list().
  */
-class ThemeItemListUnitTest extends DrupalWebTestCase {
+class ThemeItemListUnitTest extends DrupalUnitTestCase {
   public static function getInfo() {
     return array(
       'name' => 'Theme item list',
@@ -152,14 +152,28 @@ class ThemeItemListUnitTest extends Drup
    * Test nested list rendering.
    */
   function testNestedList() {
-    $items = array('a', array('data' => 'b', 'children' => array('c', 'd')), 'e');
-    $expected = '<div class="item-list"><ul><li class="first">a</li>
-<li>b<div class="item-list"><ul><li class="first">c</li>
-<li class="last">d</li>
-</ul></div></li>
-<li class="last">e</li>
-</ul></div>';
-    $output = theme('item_list', array('items' => $items, 'type' => 'ul', 'title' => NULL, 'attributes' => array()));
+    $items = array(
+      'a',
+      array(
+        'data' => 'b',
+        'children' => array(
+          'c',
+          'd',
+        ),
+      ),
+      'e',
+    );
+    $inner = '<div class="item-list"><ul>';
+    $inner .= '<li class="odd first">c</li>';
+    $inner .= '<li class="even last">d</li>';
+    $inner .= '</ul></div>';
+
+    $expected = '<div class="item-list"><ul>';
+    $expected .= '<li class="odd first">a</li>';
+    $expected .= '<li class="even">b' . $inner . '</li>';
+    $expected .= '<li class="odd last">e</li></ul></div>';
+
+    $output = theme('item_list', array('items' => $items));
     $this->assertIdentical($expected, $output, 'Nested list is rendered correctly.');
   }
 }
