Index: modules/user/user.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.test,v
retrieving revision 1.84
diff -u -r1.84 user.test
--- modules/user/user.test	25 Feb 2010 10:00:38 -0000	1.84
+++ modules/user/user.test	2 Mar 2010 15:51:19 -0000
@@ -143,7 +143,7 @@
     variable_set('user_default_timezone', DRUPAL_USER_TIMEZONE_SELECT);
     $this->drupalLogout();
     $this->drupalGet('user/register');
-    $this->assertRaw('<fieldset id="edit-account"><legend>Account information</legend>', t('Account settings fieldset was not hidden.'));
+    $this->assertText(t('Account information'), t('Account settings fieldset was not hidden.'));
   }
 }
 
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.432
diff -u -r1.432 form.inc
--- includes/form.inc	12 Feb 2010 15:11:29 -0000	1.432
+++ includes/form.inc	2 Mar 2010 15:51:18 -0000
@@ -1950,8 +1950,10 @@
 
   $output = '<fieldset' . drupal_attributes($element['#attributes']) . '>';
   if (!empty($element['#title'])) {
-    $output .= '<legend>' . $element['#title'] . '</legend>';
+    // Always wrap fieldset legends in a SPAN for CSS positioning.
+    $output .= '<legend><span class="fieldset-legend">' . $element['#title'] . '</span></legend>';
   }
+  $output .= '<div class="fieldset-wrapper">';
   if (!empty($element['#description'])) {
     $output .= '<div class="fieldset-description">' . $element['#description'] . '</div>';
   }
@@ -1959,6 +1961,7 @@
   if (isset($element['#value'])) {
     $output .= $element['#value'];
   }
+  $output .= '</div>';
   $output .= "</fieldset>\n";
   return $output;
 }
Index: themes/seven/template.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/seven/template.php,v
retrieving revision 1.13
diff -u -r1.13 template.php
--- themes/seven/template.php	25 Feb 2010 20:57:39 -0000	1.13
+++ themes/seven/template.php	2 Mar 2010 15:51:19 -0000
@@ -5,6 +5,8 @@
  * Override or insert variables into the html template.
  */
 function seven_preprocess_html(&$vars) {
+  // Add conditional CSS for IE8 and below.
+  drupal_add_css(path_to_theme() . '/ie.css', array('weight' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
   // Add conditional CSS for IE6.
   drupal_add_css(path_to_theme() . '/ie6.css', array('weight' => CSS_THEME, 'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
 }
@@ -76,29 +78,6 @@
 }
 
 /**
- * Override of theme_fieldset().
- *
- * Add span to legend tag, so we can style it to be inside the fieldset.
- */
-function seven_fieldset($variables) {
-  $element = $variables['element'];
-
-  $output = '<fieldset' . drupal_attributes($element['#attributes']) . '>';
-  if (!empty($element['#title'])) {
-    $output .= '<legend><span>' . $element['#title'] . '</span></legend>';
-  }
-  if (!empty($element['#description'])) {
-    $output .= '<div class="fieldset-description">' . $element['#description'] . '</div>';
-  }
-  $output .= $element['#children'];
-  if (isset($element['#value'])) {
-    $output .= $element['#value'];
-  }
-  $output .= "</fieldset>\n";
-  return $output;
-}
-
-/**
  * Implements hook_css_alter().
  */
 function seven_css_alter(&$css) {
Index: themes/seven/style.css
===================================================================
RCS file: /cvs/drupal/drupal/themes/seven/style.css,v
retrieving revision 1.45
diff -u -r1.45 style.css
--- themes/seven/style.css	17 Feb 2010 03:37:12 -0000	1.45
+++ themes/seven/style.css	2 Mar 2010 15:51:19 -0000
@@ -609,41 +609,38 @@
 /* Fieldsets & Form items */
 fieldset {
   border: 1px solid #ccc;
-  padding: 30px 13px 13px 14px;
+  padding: 2.5em 0 13px 0;
+  position: relative;
   margin: 0 0 10px;
 }
 
-fieldset legend span,
-fieldset legend a {
+fieldset legend .fieldset-legend {
+  margin-top: 0.5em;
+  padding-left: 15px;
   position: absolute;
-  margin-top: 9px;
+  text-transform: uppercase;
 }
 
-fieldset legend a span {
-  position: relative;
-  margin-top: 0;
+fieldset .fieldset-wrapper {
+  padding: 0 13px 0 15px;
 }
 
 fieldset.collapsed {
-  background: transparent;
+  background-color: transparent;
 }
 
-html.js fieldset.collapsed legend,
-html.js fieldset.collapsed legend * {
-  display: block;
-}
 html.js fieldset.collapsed {
   border-width: 1px;
+  height: auto;
   margin-bottom: 10px;
-  padding: 13px;
 }
 
 fieldset fieldset {
-  background: #fff;
+  background-color: #fff;
 }
 
 fieldset fieldset fieldset {
-  background: #f8f8f8;
+  background-color: #f8f8f8;
 }
 
 html.js fieldset.collapsible .fieldset-wrapper {
@@ -673,10 +670,6 @@
   padding: 0;
 }
 
-fieldset legend {
-  text-transform: uppercase;
-}
-
 div.form-item label.option {
   text-transform: none;
 }
Index: themes/seven/ie6.css
===================================================================
RCS file: /cvs/drupal/drupal/themes/seven/ie6.css,v
retrieving revision 1.3
diff -u -r1.3 ie6.css
--- themes/seven/ie6.css	30 Jan 2010 07:59:26 -0000	1.3
+++ themes/seven/ie6.css	2 Mar 2010 15:51:19 -0000
@@ -4,6 +4,7 @@
 ul.menu li a,
 ul.links li,
 ul.links li a,
+.action-links,
 #page {
   height: 1%;
 }
Index: modules/simpletest/simpletest.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.test,v
retrieving revision 1.37
diff -u -r1.37 simpletest.test
--- modules/simpletest/simpletest.test	24 Dec 2009 08:03:53 -0000	1.37
+++ modules/simpletest/simpletest.test	2 Mar 2010 15:51:18 -0000
@@ -208,11 +208,11 @@
     if ($this->parse()) {
       if ($fieldset = $this->getResultFieldSet()) {
         // Code assumes this is the only test in group.
-        $results['summary'] = $this->asText($fieldset->div[1]);
+        $results['summary'] = $this->asText($fieldset->div->div[1]);
         $results['name'] = $this->asText($fieldset->legend);
 
         $results['assertions'] = array();
-        $tbody = $fieldset->table->tbody;
+        $tbody = $fieldset->div->table->tbody;
         foreach ($tbody->tr as $row) {
           $assertion = array();
           $assertion['message'] = $this->asText($row->td[0]);
@@ -231,8 +231,6 @@
 
   /**
    * Get the fieldset containing the results for group this test is in.
-   *
-   * @return fieldset containing the results for group this test is in.
    */
   function getResultFieldSet() {
     $fieldsets = $this->xpath('//fieldset');
Index: themes/garland/style.css
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/style.css,v
retrieving revision 1.73
diff -u -r1.73 style.css
--- themes/garland/style.css	30 Jan 2010 07:59:26 -0000	1.73
+++ themes/garland/style.css	2 Mar 2010 15:51:19 -0000
@@ -892,12 +892,12 @@
   background-position: 0 0;
 }
 
-*:first-child+html fieldset > .description, *:first-child+html fieldset .fieldset-wrapper .description {
+*:first-child+html fieldset .fieldset-wrapper .description {
   padding-top: 1em;
 }
 
+/* Fix disappearing legend in FFox */
 fieldset legend {
-  /* Fix disappearing legend in FFox */
   display: block;
 }
 
@@ -911,7 +911,7 @@
   padding-bottom: .6em;
 }
 
-html.js fieldset.collapsible legend a {
+html.js fieldset.collapsible legend .fieldset-legend {
   padding-left: 2em; /* LTR */
   background: url(images/menu-expanded.gif) no-repeat 0% 50%; /* LTR */
 }
@@ -920,7 +920,7 @@
   color: #898989;
 }
 
-html.js fieldset.collapsed legend a {
+html.js fieldset.collapsed legend .fieldset-legend {
   background: url(images/menu-collapsed.gif) no-repeat 0% 50%; /* LTR */
 }
 
Index: misc/collapse.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/collapse.js,v
retrieving revision 1.27
diff -u -r1.27 collapse.js
--- misc/collapse.js	8 Nov 2009 11:46:22 -0000	1.27
+++ misc/collapse.js	2 Mar 2010 15:51:18 -0000
@@ -5,40 +5,33 @@
  * Toggle the visibility of a fieldset using smooth animations.
  */
 Drupal.toggleFieldset = function (fieldset) {
-  if ($(fieldset).is('.collapsed')) {
-    // Action div containers are processed separately because of a IE bug
-    // that alters the default submit button behavior.
-    var content = $('> div:not(.action)', fieldset);
-    $(fieldset)
+  var $fieldset = $(fieldset);
+  if ($fieldset.is('.collapsed')) {
+    var $content = $('> .fieldset-wrapper', fieldset).hide();
+    $fieldset
       .removeClass('collapsed')
       .trigger({ type: 'collapsed', value: false })
-      .find('> legend > a > span.element-invisible')
-        .empty()
-        .append(Drupal.t('Hide'));
-    content.hide();
-    content.slideDown({
+      .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Hide'));
+    $content.slideDown({
       duration: 'fast',
       easing: 'linear',
       complete: function () {
-        Drupal.collapseScrollIntoView(this.parentNode);
-        this.parentNode.animating = false;
-        $('div.action', fieldset).show();
+        Drupal.collapseScrollIntoView(fieldset);
+        fieldset.animating = false;
       },
       step: function () {
         // Scroll the fieldset into view.
-        Drupal.collapseScrollIntoView(this.parentNode);
+        Drupal.collapseScrollIntoView(fieldset);
       }
     });
   }
   else {
-    $('div.action', fieldset).hide();
-    $(fieldset).trigger({ type: 'collapsed', value: true });
-    var content = $('> div:not(.action)', fieldset).slideUp('fast', function () {
-      $(this.parentNode).addClass('collapsed')
-        .find('> legend > a > span.element-invisible')
-          .empty()
-          .append(Drupal.t('Show'));
-      this.parentNode.animating = false;
+    $fieldset.trigger({ type: 'collapsed', value: true });
+    $('> .fieldset-wrapper', fieldset).slideUp('fast', function () {
+      $fieldset
+        .addClass('collapsed')
+        .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Show'));
+      fieldset.animating = false;
     });
   }
 };
@@ -63,28 +56,30 @@
 
 Drupal.behaviors.collapse = {
   attach: function (context, settings) {
-    $('fieldset.collapsible > legend', context).once('collapse', function () {
-      var fieldset = $(this.parentNode);
+    $('fieldset.collapsible', context).once('collapse', function () {
+      var $fieldset = $(this);
       // Expand if there are errors inside.
-      if ($('input.error, textarea.error, select.error', fieldset).size() > 0) {
-        fieldset.removeClass('collapsed');
+      if ($('.error', $fieldset).length) {
+        $fieldset.removeClass('collapsed');
       }
 
       var summary = $('<span class="summary"></span>');
-      fieldset.
+      $fieldset.
         bind('summaryUpdated', function () {
-          var text = $.trim(fieldset.getSummary());
+          var text = $.trim($fieldset.getSummary());
           summary.html(text ? ' (' + text + ')' : '');
         })
         .trigger('summaryUpdated');
 
-      // Turn the legend into a clickable link and wrap the contents of the
-      // fieldset in a div for easier animation.
-      var text = this.innerHTML;
-      $(this).empty()
-        .append($('<a href="#">' + text + '</a>')
+      // Turn the legend into a clickable link, but retain span.fieldset-legend
+      // for CSS positioning.
+      // @todo Properly use .wrap() here.
+      var $legend = $('> legend .fieldset-legend', this);
+      var text = $legend.html();
+      $legend.empty()
+        .append($('<a class="fieldset-title" href="#">' + text + '</a>')
           .click(function () {
-            var fieldset = $(this).parents('fieldset:first')[0];
+            var fieldset = $fieldset.get(0);
             // Don't animate multiple times.
             if (!fieldset.animating) {
               fieldset.animating = true;
@@ -92,16 +87,12 @@
             }
             return false;
           })
-          .prepend($('<span class="element-invisible"></span>')
-            .append(fieldset.hasClass('collapsed') ? Drupal.t('Show') : Drupal.t('Hide'))
+          .prepend($('<span class="fieldset-legend-prefix element-invisible"></span>')
+            .append($fieldset.hasClass('collapsed') ? Drupal.t('Show') : Drupal.t('Hide'))
             .after(' ')
           )
         )
-        .append(summary)
-        .after(
-          $('<div class="fieldset-wrapper"></div>')
-            .append(fieldset.children(':not(legend):not(.action)'))
-        );
+        .append(summary);
     });
   }
 };
Index: modules/system/system-behavior.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system-behavior.css,v
retrieving revision 1.4
diff -u -r1.4 system-behavior.css
--- modules/system/system-behavior.css	16 Feb 2010 01:05:52 -0000	1.4
+++ modules/system/system-behavior.css	2 Mar 2010 15:51:18 -0000
@@ -46,35 +46,28 @@
   margin-bottom: 0;
   height: 1em;
 }
-html.js fieldset.collapsed * {
+html.js fieldset.collapsed .fieldset-wrapper {
   display: none;
 }
-html.js fieldset.collapsed legend, html.js fieldset.collapsed legend a span.element-invisible {
+html.js fieldset.collapsible legend .fieldset-legend {
   display: block;
-  overflow: hidden;
-}
-html.js fieldset.collapsible legend a {
-  display: inline;
   padding-left: 15px; /* LTR */
   background: url(../../misc/menu-expanded.png) 5px 75% no-repeat; /* LTR */
 }
 html.js fieldset.collapsible legend span.summary {
-  display: inline;
   font-size: 0.9em;
   color: #999;
   margin-left: 0.5em;
 }
-html.js fieldset.collapsed legend a {
+html.js fieldset.collapsed legend .fieldset-legend {
   background-image: url(../../misc/menu-collapsed.png); /* LTR */
   background-position: 5px 50%; /* LTR */
 }
-/* Note: IE-only fix due to '* html' (breaks Konqueror otherwise). */
-* html.js fieldset.collapsed legend,
-* html.js fieldset.collapsed legend *,
+/* IE6: Fix due to '* html' (breaks Konqueror otherwise). */
 * html.js fieldset.collapsed table * {
   display: inline;
 }
-/* For Safari 2 to prevent collapsible fieldsets containing tables from dissapearing due to tableheader.js. */
+/* Safari 2: Tables in collapsible fieldsets disappear due to tableheader.js. */
 html.js fieldset.collapsible {
   position: relative;
 }
Index: themes/seven/ie.css
===================================================================
RCS file: themes/seven/ie.css
diff -N themes/seven/ie.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ themes/seven/ie.css	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,7 @@
+/* $Id$ */
+
+/* IE (all) renders absolute positioned fieldset legend where fieldset content starts */
+fieldset .fieldset-legend {
+  left: 0;
+  top: 0;
+}
