Index: modules/overlay/overlay-parent.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay-parent.js,v
retrieving revision 1.12
diff -u -r1.12 overlay-parent.js
--- modules/overlay/overlay-parent.js	6 Jan 2010 04:03:39 -0000	1.12
+++ modules/overlay/overlay-parent.js	6 Jan 2010 10:12:07 -0000
@@ -282,6 +282,10 @@
 
   // Change the overlay title.
   self.$container.dialog('option', 'title', Drupal.t('Loading...'));
+  // Remove any existing shortcut button markup in the title section.
+  self.$dialogTitlebar.find('.add-or-remove-shortcuts').remove();
+  // Remove any existing tabs in the title section.
+  self.$dialogTitlebar.find('ul').remove();
 
   // When a new overlay is opened and loaded, we add a loaded class to the
   // dialog. The loaded class is not removed and added back again while
@@ -405,8 +409,6 @@
   // Add a title attribute to the iframe for accessibility.
   self.$iframe.attr('title', Drupal.t('@title dialog', { '@title': iframeTitle }));
 
-  // Remove any existing shortcut button markup in the title section.
-  self.$dialogTitlebar.find('.add-or-remove-shortcuts').remove();
   // If the shortcut add/delete button exists, move it to the dialog title.
   var $addToShortcuts = self.$iframeWindow('.add-or-remove-shortcuts');
   if ($addToShortcuts.length) {
@@ -418,8 +420,6 @@
     self.$dialogTitlebar.find('.ui-dialog-title').after($addToShortcuts);
   }
 
-  // Remove any existing tabs in the title section.
-  self.$dialogTitlebar.find('ul').remove();
   // If there are tabs in the page, move them to the titlebar.
   var $tabs = self.$iframeWindow('ul.primary');
   if ($tabs.length) {
