Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1222
diff -u -p -r1.1222 common.inc
--- includes/common.inc	17 Sep 2010 14:53:21 -0000	1.1222
+++ includes/common.inc	18 Sep 2010 00:47:12 -0000
@@ -5476,8 +5476,12 @@ function element_sort_by_title($a, $b) {
 
 /**
  * Retrieve the default properties for the defined element type.
+ *
+ * @param $element
+ *   (optional) A new element array to (intelligently) merge the default element
+ *   type properties into.
  */
-function element_info($type) {
+function element_info($type, array $element = NULL) {
   // Use the advanced drupal_static() pattern, since this is called very often.
   static $drupal_static_fast;
   if (!isset($drupal_static_fast)) {
@@ -5494,6 +5498,36 @@ function element_info($type) {
     drupal_alter('element_info', $cache);
   }
 
+  // Intelligently merge default element properties into the optionally passed
+  // new element.
+  if (isset($element)) {
+    // Inform form_builder() and drupal_render() that defaults have been loaded.
+    $element['#defaults_loaded'] = TRUE;
+    if (!isset($cache[$type])) {
+      return $element;
+    }
+    // Prepend custom values defined in $element to default element type info.
+    // Most often, the custom values are expected to take effect prior to the
+    // default values.
+    foreach (array('#process', '#pre_render', '#theme_wrappers') as $property) {
+      if (isset($cache[$type][$property])) {
+        $element += array($property => array());
+        $element[$property] = array_merge($element[$property], $cache[$type][$property]);
+      }
+    }
+    // Merge values in $element into default element type info. Custom scalar
+    // values override the default values, while array values are merged.
+    foreach (array('#attributes') as $property) {
+      if (isset($cache[$type][$property])) {
+        $element += array($property => array());
+        $element[$property] = array_merge($cache[$type][$property], $element[$property]);
+      }
+    }
+    // Add other default element properties, if undefined in $element.
+    $element += $cache[$type];
+    return $element;
+  }
+
   return isset($cache[$type]) ? $cache[$type] : array();
 }
 
Index: modules/field_ui/field_ui.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field_ui/field_ui.admin.inc,v
retrieving revision 1.66
diff -u -p -r1.66 field_ui.admin.inc
--- modules/field_ui/field_ui.admin.inc	16 Sep 2010 20:14:49 -0000	1.66
+++ modules/field_ui/field_ui.admin.inc	18 Sep 2010 00:43:01 -0000
@@ -1648,15 +1648,8 @@ function field_ui_field_edit_form($form,
   $bundles = field_info_bundles();
 
   // Create a form structure for the instance values.
-  // @todo Fieldset element info needs to be merged in order to not skip the
-  //   default element definition for #pre_render. While the current default
-  //   value could simply be hard-coded, we'd possibly forget this location
-  //   when system_element_info() is updated. See also form_builder(). This
-  //   particular #pre_render, field_ui_field_edit_instance_pre_render(), might
-  //   as well be entirely needless though.
-  $form['instance'] = array_merge(element_info('fieldset'), array(
+  $form['instance'] = element_info('fieldset', array(
     '#tree' => TRUE,
-    '#type' => 'fieldset',
     '#title' => t('%type settings', array('%type' => $bundles[$entity_type][$bundle]['label'])),
     '#description' => t('These settings apply only to the %field field when used in the %type type.', array(
       '%field' => $instance['label'],
