diff --git a/misc/drupal.js b/misc/drupal.js
index 83b0884..517d3eb 100644
--- a/misc/drupal.js
+++ b/misc/drupal.js
@@ -1,4 +1,3 @@
-
 var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'locale': {} };
 
 // Allow other JavaScript libraries to use $.
@@ -49,12 +48,13 @@ jQuery.noConflict();
 Drupal.attachBehaviors = function (context, settings) {
   context = context || document;
   settings = settings || Drupal.settings;
+  var i, behaviors = Drupal.behaviors;
   // Execute all of them.
-  $.each(Drupal.behaviors, function () {
-    if ($.isFunction(this.attach)) {
-      this.attach(context, settings);
+  for (i in behaviors) {
+    if (behaviors.hasOwnProperty(i) && typeof behaviors[i].attach === 'function') {
+      behaviors[i].attach(context, settings);
     }
-  });
+  }
 };
 
 /**
@@ -101,12 +101,13 @@ Drupal.detachBehaviors = function (context, settings, trigger) {
   context = context || document;
   settings = settings || Drupal.settings;
   trigger = trigger || 'unload';
+  var i, behaviors = Drupal.behaviors;
   // Execute all of them.
-  $.each(Drupal.behaviors, function () {
-    if ($.isFunction(this.detach)) {
-      this.detach(context, settings, trigger);
+  for (i in behaviors) {
+    if (behaviors.hasOwnProperty(i) && typeof behaviors[i].detach === 'function') {
+      behaviors[i].detach(context, settings, trigger);
     }
-  });
+  }
 };
 
 /**
diff --git a/misc/form.js b/misc/form.js
index 259b84e..ed7d4b3 100644
--- a/misc/form.js
+++ b/misc/form.js
@@ -62,15 +62,17 @@ Drupal.behaviors.formUpdated = {
  */
 Drupal.behaviors.fillUserInfoFromCookie = {
   attach: function (context, settings) {
+    var userInfo = ['name', 'mail', 'homepage'];
     $('form.user-info-from-cookie').once('user-info-from-cookie', function () {
       var formContext = this;
-      $.each(['name', 'mail', 'homepage'], function () {
-        var $element = $('[name=' + this + ']', formContext);
-        var cookie = $.cookie('Drupal.visitor.' + this);
+      var i, il, $element, cookie;
+      for (i = 0, il = userInfo.length; i < il; i += 1) {
+        $element = $('[name=' + userInfo[i] + ']', formContext);
+        cookie = $.cookie('Drupal.visitor.' + userInfo[i]);
         if ($element.length && cookie) {
           $element.val(cookie);
         }
-      });
+      }
     });
   }
 };
diff --git a/misc/machine-name.js b/misc/machine-name.js
index ced8c4b..19d4bb7 100644
--- a/misc/machine-name.js
+++ b/misc/machine-name.js
@@ -26,80 +26,85 @@ Drupal.behaviors.machineName = {
    */
   attach: function (context, settings) {
     var self = this;
-    $.each(settings.machineName, function (source_id, options) {
-      var $source = $(source_id, context).addClass('machine-name-source');
-      var $target = $(options.target, context).addClass('machine-name-target');
-      var $suffix = $(options.suffix, context);
-      var $wrapper = $target.closest('.form-item');
-      // All elements have to exist.
-      if (!$source.length || !$target.length || !$suffix.length || !$wrapper.length) {
-        return;
-      }
-      // Skip processing upon a form validation error on the machine name.
-      if ($target.hasClass('error')) {
-        return;
-      }
-      // Figure out the maximum length for the machine name.
-      options.maxlength = $target.attr('maxlength');
-      // Hide the form item container of the machine name form element.
-      $wrapper.hide();
-      // Determine the initial machine name value. Unless the machine name form
-      // element is disabled or not empty, the initial default value is based on
-      // the human-readable form element value.
-      if ($target.is(':disabled') || $target.val() != '') {
-        var machine = $target.val();
-      }
-      else {
-        var machine = self.transliterate($source.val(), options);
-      }
-      // Append the machine name preview to the source field.
-      var $preview = $('<span class="machine-name-value">' + options.field_prefix + Drupal.checkPlain(machine) + options.field_suffix + '</span>');
-      $suffix.empty();
-      if (options.label) {
-        $suffix.append(' ').append('<span class="machine-name-label">' + options.label + ':</span>');
-      }
-      $suffix.append(' ').append($preview);
-
-      // If the machine name cannot be edited, stop further processing.
-      if ($target.is(':disabled')) {
-        return;
-      }
-
-      // If it is editable, append an edit link.
-      var $link = $('<span class="admin-link"><a href="#">' + Drupal.t('Edit') + '</a></span>')
-        .click(function () {
-          $wrapper.show();
-          $target.focus();
-          $suffix.hide();
-          $source.unbind('.machineName');
-          return false;
-        });
-      $suffix.append(' ').append($link);
 
-      // Preview the machine name in realtime when the human-readable name
-      // changes, but only if there is no machine name yet; i.e., only upon
-      // initial creation, not when editing.
-      if ($target.val() == '') {
-        $source.bind('keyup.machineName change.machineName', function () {
-          machine = self.transliterate($(this).val(), options);
-          // Set the machine name to the transliterated value.
-          if (machine != '') {
-            if (machine != options.replace) {
-              $target.val(machine);
-              $preview.html(options.field_prefix + Drupal.checkPlain(machine) + options.field_suffix);
-            }
-            $suffix.show();
+    for (var i in settings.machineName) {
+      if (settings.machineName.hasOwnProperty(i)) {
+        (function (source_id, options) {
+          var $source = $(source_id, context).addClass('machine-name-source');
+          var $target = $(options.target, context).addClass('machine-name-target');
+          var $suffix = $(options.suffix, context);
+          var $wrapper = $target.closest('.form-item');
+          // All elements have to exist.
+          if (!$source.length || !$target.length || !$suffix.length || !$wrapper.length) {
+            return;
+          }
+          // Skip processing upon a form validation error on the machine name.
+          if ($target.hasClass('error')) {
+            return;
+          }
+          // Figure out the maximum length for the machine name.
+          options.maxlength = $target.attr('maxlength');
+          // Hide the form item container of the machine name form element.
+          $wrapper.hide();
+          // Determine the initial machine name value. Unless the machine name form
+          // element is disabled or not empty, the initial default value is based on
+          // the human-readable form element value.
+          if ($target.is(':disabled') || $target.val() != '') {
+            var machine = $target.val();
           }
           else {
-            $suffix.hide();
-            $target.val(machine);
-            $preview.empty();
+            var machine = self.transliterate($source.val(), options);
+          }
+          // Append the machine name preview to the source field.
+          var $preview = $('<span class="machine-name-value">' + options.field_prefix + Drupal.checkPlain(machine) + options.field_suffix + '</span>');
+          $suffix.empty();
+          if (options.label) {
+            $suffix.append(' ').append('<span class="machine-name-label">' + options.label + ':</span>');
+          }
+          $suffix.append(' ').append($preview);
+
+          // If the machine name cannot be edited, stop further processing.
+          if ($target.is(':disabled')) {
+            return;
+          }
+
+          // If it is editable, append an edit link.
+          var $link = $('<span class="admin-link"><a href="#">' + Drupal.t('Edit') + '</a></span>')
+            .click(function () {
+              $wrapper.show();
+              $target.focus();
+              $suffix.hide();
+              $source.unbind('.machineName');
+              return false;
+            });
+          $suffix.append(' ').append($link);
+
+          // Preview the machine name in realtime when the human-readable name
+          // changes, but only if there is no machine name yet; i.e., only upon
+          // initial creation, not when editing.
+          if ($target.val() == '') {
+            $source.bind('keyup.machineName change.machineName', function () {
+              machine = self.transliterate($(this).val(), options);
+              // Set the machine name to the transliterated value.
+              if (machine != '') {
+                if (machine != options.replace) {
+                  $target.val(machine);
+                  $preview.html(options.field_prefix + Drupal.checkPlain(machine) + options.field_suffix);
+                }
+                $suffix.show();
+              }
+              else {
+                $suffix.hide();
+                $target.val(machine);
+                $preview.empty();
+              }
+            });
+            // Initialize machine name preview.
+            $source.keyup();
           }
-        });
-        // Initialize machine name preview.
-        $source.keyup();
+        }(i, settings.machineName[i]));
       }
-    });
+    }
   },
 
   /**
diff --git a/modules/dashboard/dashboard.js b/modules/dashboard/dashboard.js
index 83ffc1f..d9b6a00 100644
--- a/modules/dashboard/dashboard.js
+++ b/modules/dashboard/dashboard.js
@@ -211,9 +211,9 @@ Drupal.behaviors.dashboard = {
     $('#dashboard div.region').each(function () {
       var region = $(this).parent().attr('id').replace(/-/g, '_');
       var blocks = $(this).sortable('toArray');
-      $.each(blocks, function() {
-        order.push(region + '[]=' + this);
-      });
+      for (var i = 0, il = blocks.length; i < il; i += 1) {
+        order.push(region + '[]=' + blocks[i]);
+      }
     });
     order = order.join('&');
     return order;
diff --git a/modules/field_ui/field_ui.js b/modules/field_ui/field_ui.js
index 1017937..35c1836 100644
--- a/modules/field_ui/field_ui.js
+++ b/modules/field_ui/field_ui.js
@@ -2,7 +2,7 @@
  * @file
  * Attaches the behaviors for the Field UI module.
  */
- 
+
 (function($) {
 
 Drupal.behaviors.fieldUIFieldOverview = {
@@ -232,10 +232,13 @@ Drupal.fieldUIOverview = {
     // Separate keys and values.
     var rowNames = [];
     var ajaxElements = [];
-    $.each(rows, function (rowName, ajaxElement) {
-      rowNames.push(rowName);
-      ajaxElements.push(ajaxElement);
-    });
+    var rowName;
+    for (rowName in rows) {
+      if (rows.hasOwnProperty(rowName)) {
+        rowNames.push(rowName);
+        ajaxElements.push(rows[rowName]);
+      }
+    }
 
     if (rowNames.length) {
       // Add a throbber next each of the ajaxElements.
diff --git a/modules/file/file.js b/modules/file/file.js
index 1a9f87e..c66362c 100644
--- a/modules/file/file.js
+++ b/modules/file/file.js
@@ -14,18 +14,27 @@
  */
 Drupal.behaviors.fileValidateAutoAttach = {
   attach: function (context, settings) {
+    var validateExtension = Drupal.file.validateExtension;
+    var selector, elements;
     if (settings.file && settings.file.elements) {
-      $.each(settings.file.elements, function(selector) {
-        var extensions = settings.file.elements[selector];
-        $(selector, context).bind('change', {extensions: extensions}, Drupal.file.validateExtension);
-      });
+      elements = settings.file.elements;
+      for (selector in elements) {
+        if (elements.hasOwnProperty(selector)) {
+          $(selector, context).bind('change', {extensions: elements[selector]}, validateExtension);
+        }
+      }
     }
   },
   detach: function (context, settings) {
+    var validateExtension = Drupal.file.validateExtension;
+    var selector, elements;
     if (settings.file && settings.file.elements) {
-      $.each(settings.file.elements, function(selector) {
-        $(selector, context).unbind('change', Drupal.file.validateExtension);
-      });
+      elements = settings.file.elements;
+      for (selector in elements) {
+        if (elements.hasOwnProperty(selector)) {
+          $(selector, context).unbind('change', validateExtension);
+        }
+      }
     }
   }
 };
diff --git a/modules/overlay/overlay-child.js b/modules/overlay/overlay-child.js
index e78e383..9096db7 100644
--- a/modules/overlay/overlay-child.js
+++ b/modules/overlay/overlay-child.js
@@ -1,4 +1,3 @@
-
 (function ($) {
 
 /**
@@ -85,9 +84,12 @@ Drupal.overlayChild.prototype = {};
  * Attach child related behaviors to the iframe document.
  */
 Drupal.overlayChild.attachBehaviors = function (context, settings) {
-  $.each(this.behaviors, function () {
-    this(context, settings);
-  });
+  var behavior, behaviors = this.behaviors;
+  for (behavior in behaviors) {
+    if (behaviors.hasOwnProperty(behavior)) {
+      behaviors[behavior](context, settings);
+    }
+  }
 };
 
 /**
diff --git a/modules/overlay/overlay-parent.js b/modules/overlay/overlay-parent.js
index ace7def..e8c0672 100644
--- a/modules/overlay/overlay-parent.js
+++ b/modules/overlay/overlay-parent.js
@@ -767,19 +767,24 @@ Drupal.overlay.fragmentizeLink = function (link, parentLocation) {
  *   corresponding to this region.
  */
 Drupal.overlay.refreshRegions = function (data) {
-  $.each(data, function () {
-    var region_info = this;
-    $.each(region_info, function (regionClass) {
-      var regionName = region_info[regionClass];
-      var regionSelector = '.' + regionClass;
-      // Allow special behaviors to detach.
-      Drupal.detachBehaviors($(regionSelector));
-      $.get(Drupal.settings.basePath + Drupal.settings.overlay.ajaxCallback + '/' + regionName, function (newElement) {
-        $(regionSelector).replaceWith($(newElement));
-        Drupal.attachBehaviors($(regionSelector), Drupal.settings);
-      });
-    });
-  });
+  var region, region_info, regionClass, regionName, regionSelector;
+  for (region in data) {
+    if (data.hasOwnProperty(region)) {
+      region_info = data[region];
+      for (regionClass in region_info) {
+        if (region_info.hasOwnProperty(regionClass)) {
+          (function (regionName, regionSelector) {
+            var $region = $(regionSelector);
+            Drupal.detachBehaviors($region);
+            $.get(Drupal.settings.basePath + Drupal.settings.overlay.ajaxCallback + '/' + regionName, function (newElement) {
+              $region.replaceWith($(newElement));
+              Drupal.attachBehaviors($region, Drupal.settings);
+            });
+          }(region_info[regionClass], '.' + regionClass));
+        }
+      }
+    }
+  }
 };
 
 /**
