Index: modules/overlay/overlay-parent.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay-parent.js,v
retrieving revision 1.7
diff -u -p -r1.7 overlay-parent.js
--- modules/overlay/overlay-parent.js	15 Dec 2009 05:28:59 -0000	1.7
+++ modules/overlay/overlay-parent.js	16 Dec 2009 14:23:08 -0000
@@ -698,7 +698,7 @@ Drupal.overlay.resize = function (size) 
     // Proceed only if the dialog still exists.
     if ($.isObject(self.iframe.$element) && $.isObject(self.iframe.$container)) {
       // Resize the iframe element and container.
-      $('.overlay').width(dialogSize.width).height(dialogSize.height);
+      $(this).width(dialogSize.width).height(dialogSize.height);
       self.iframe.$container.width(frameSize.width).height(frameSize.height);
       self.iframe.$element.width(frameSize.width).height(frameSize.height);
 
@@ -708,8 +708,11 @@ Drupal.overlay.resize = function (size) 
       // Keep the dim background grow or shrink with the dialog.
       $('.ui-widget-overlay').height($(document).height());
 
-      // Animate body opacity, so we fade in the page as it loads in.
-      $(self.iframe.$element.get(0)).contents().find('body.overlay').animate({opacity: 0.9999}, 'slow');
+      // Animate the iframe element opacity, so the page fades in as it loads.
+      // Note that selecting any part of the document inside the iframe to
+      // animate instead would lead to severe performance problems on certain
+      // clients.
+      self.iframe.$element.animate({opacity: 0.9999}, 'slow');
     }
   });
 };
