? 922796-options-not-modifiable.patch
? 932848-fix-setClick-no-really.patch
? 939398-no-theme-arguments-makes-notice.patch
? 939568-named-ajax-trigger-function.patch
? 954804-make-libraries.patch
? 961518-inline-css-no-preprocess.patch
? 969346-before-submit-should-be-before-send.patch
? ajax-commandinsert-736066-26.patch
? d7p3.sql
? drupal.ajax-event-handlers.17.patch
? drupal.ajax-lazy-load.153.patch
? drupal.ajax-link.52.patch
? drupal.ajax_lazy_load_561858_142.patch
? named-ajax-trigger-function.patch
? sites/all/modules
? sites/all/themes/blank
? sites/all/themes/jean
? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: misc/ajax.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/ajax.js,v
retrieving revision 1.28
diff -u -p -r1.28 ajax.js
--- misc/ajax.js	12 Nov 2010 03:02:43 -0000	1.28
+++ misc/ajax.js	17 Nov 2010 18:50:05 -0000
@@ -112,6 +112,7 @@ Drupal.ajax = function (base, element, e
   $.extend(this, defaults, element_settings);
 
   this.element = element;
+  this.element_settings = element_settings;
 
   // Replacing 'nojs' with 'ajax' in the URL allows for an easy method to let
   // the server detect when it needs to degrade gracefully.
@@ -165,35 +166,8 @@ Drupal.ajax = function (base, element, e
   };
 
   // Bind the ajaxSubmit function to the element event.
-  $(this.element).bind(element_settings.event, function () {
-    if (ajax.ajaxing) {
-      return false;
-    }
-
-    try {
-      if (ajax.form) {
-        // If setClick is set, we must set this to ensure that the button's
-        // value is passed.
-        if (ajax.setClick) {
-          // Mark the clicked button. 'form.clk' is a special variable for
-          // ajaxSubmit that tells the system which element got clicked to
-          // trigger the submit. Without it there would be no 'op' or
-          // equivalent.
-          this.form.clk = this;
-        }
-
-        ajax.form.ajaxSubmit(ajax.options);
-      }
-      else {
-        ajax.beforeSerialize(ajax.element, ajax.options);
-        $.ajax(ajax.options);
-      }
-    }
-    catch (e) {
-      alert("An error occurred while attempting to process " + ajax.options.url + ": " + e.message);
-    }
-
-    return false;
+  $(ajax.element).bind(element_settings.event, function (event) {
+    return ajax.eventResponse(this, event);
   });
 
   // If necessary, enable keyboard submission so that AJAX behaviors
@@ -201,15 +175,71 @@ Drupal.ajax = function (base, element, e
   // action.
   if (element_settings.keypress) {
     $(element_settings.element).keypress(function (event) {
-      // Detect enter key and space bar.
-      if (event.which == 13 || event.which == 32) {
-        $(element_settings.element).trigger(element_settings.event);
-        return false;
-      }
+      return ajax.keypressResponse(this, event);
     });
   }
 };
 
+/*
+ * Handle a key press.
+ *
+ * The AJAX object will, if instructed, bind to a key press response. This
+ * will test to see if the key press is valid to trigger this event and
+ * if it is, trigger it for us and prevent other keypresses from triggering.
+ */
+Drupal.ajax.prototype.keypressResponse = function (trigger, event) {
+  // Create a synonym for this to reduce code confusion.
+  var ajax = this;
+
+  // Detect enter key and space bar.
+  if (event.which == 13 || event.which == 32) {
+    $(ajax.element_settings.element).trigger(ajax.element_settings.event);
+    return false;
+  }
+};
+
+/**
+ * Handle an event that triggers an AJAX response.
+ *
+ * When an event that triggers an AJAX response happens, this method will
+ * perform the actual AJAX call. It is bound to the event using
+ * bind() in the constructor, and it uses the options specified on the
+ * ajax object.
+ */
+Drupal.ajax.prototype.eventResponse = function (trigger, event) {
+  // Create a synonym for this to reduce code confusion.
+  var ajax = this;
+
+  if (ajax.ajaxing) {
+    return false;
+  }
+
+  try {
+    if (ajax.form) {
+      // If setClick is set, we must set this to ensure that the button's
+      // value is passed.
+      if (ajax.setClick) {
+        // Mark the clicked button. 'form.clk' is a special variable for
+        // ajaxSubmit that tells the system which element got clicked to
+        // trigger the submit. Without it there would be no 'op' or
+        // equivalent.
+        trigger.form.clk = trigger;
+      }
+
+      ajax.form.ajaxSubmit(ajax.options);
+    }
+    else {
+      ajax.beforeSerialize(ajax.element, ajax.options);
+      $.ajax(ajax.options);
+    }
+  }
+  catch (e) {
+    alert("An error occurred while attempting to process " + ajax.options.url + ": " + e.message);
+  }
+
+  return false;
+};
+
 /**
  * Handler for the form serialization.
  *
