<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,5 @@
+* Ajax.InPlaceEditor now can deal with callbacks that return an object.  Closes #10064.  [tdd]
+
 * Fix a potential problem with the loader and Firefox 2.0 on the Mac.  Closes #9951.  [awaters]
 
 * Update to Prototype trunk revision [8057].</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -621,8 +621,10 @@ Ajax.InPlaceEditor = Class.create({
     var form = this._form;
     var value = $F(this._controls.editor);
     this.prepareSubmission();
-    var params = this.options.callback(form, value);
-    params = (params ? params + '&amp;' : '?') + 'editorId=' + this.element.id;
+    var params = this.options.callback(form, value) || '';
+    if (Object.isString(params))
+      params = params.toQueryParams();
+    params.editorId = this.element.id;
     if (this.options.htmlResponse) {
       var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions);
       Object.extend(options, {</diff>
      <filename>src/controls.js</filename>
    </modified>
    <modified>
      <diff>@@ -169,7 +169,7 @@ Third line&lt;/div&gt;
     }},
 
     testCallbackFunctionGetsCalled: function() { with(this) {
-      called = false;
+      var called = false;
       inPlaceEditor.options.callback = function(form) {
         called = true;
       }
@@ -372,6 +372,39 @@ Third line&lt;/div&gt;
       });
     }},
 
+    testCallbackFunctionReturnTypes: function() { with(this) {
+      var params = [];
+      var responder = {
+        onCreate: function(req) {
+          params.push(req.options.parameters);
+        }
+      };
+      Ajax.Responders.register(responder);
+      var ipe = new Ajax.InPlaceEditor('newtbe', '_ajax_inplaceeditor_result2.html', {
+        callback: function(form) {
+          return 'foo=bar';
+        }
+      });
+      Event.simulateMouse('newtbe', 'click');
+      Event.simulateKey('newtbe', 'keydown', { keyCode: Event.KEY_RETURN });
+      wait(200, function() {
+        assert(params[0] &amp;&amp; params[0].foo == 'bar');
+        ipe.dispose();
+        ipe = new Ajax.InPlaceEditor('newtbe', '_ajax_inplaceeditor_result2.html', {
+          callback: function(form) {
+            return { bar: '?', 'r&amp;d': 42 };
+          }
+        });
+        Event.simulateMouse('newtbe', 'click');
+        Event.simulateKey('newtbe', 'keydown', { keyCode: Event.KEY_RETURN });
+        wait(200, function() {
+          assert(params[1] &amp;&amp; params[1].bar == '?' &amp;&amp; params[1]['r&amp;d'] == 42);
+          ipe.dispose();
+          Ajax.Responders.unregister(responder);
+        })
+      });
+    }},
+
     testHtmlResponse: function() {with(this) {
       // Default (true) -&gt; A.U w/ evalScripts: true
       $('newtbe').update('New to be edited');</diff>
      <filename>test/unit/ajax_inplaceeditor_test.html</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>71161b07c747576b32ae8d5de6adbf8138b3fb13</id>
    </parent>
  </parents>
  <author>
    <name>Thomas Fuchs</name>
    <email>thomas@fesch.at</email>
  </author>
  <url>http://github.com/madrobby/scriptaculous/commit/fbf03517f7a6f8a5b9ba17fdd7a73dad39df71d4</url>
  <id>fbf03517f7a6f8a5b9ba17fdd7a73dad39df71d4</id>
  <committed-date>2007-11-03T09:34:21-07:00</committed-date>
  <authored-date>2007-11-03T09:34:21-07:00</authored-date>
  <message>script.aculo.us:  Ajax.InPlaceEditor now can deal with callbacks that return an object

git-svn-id: http://svn.rubyonrails.org/rails/spinoffs/scriptaculous@8069 5ecf4fe2-1ee6-0310-87b1-e25e094e27de</message>
  <tree>587927245a80a8d6ca23be01ba0b1d430ba67d28</tree>
  <committer>
    <name>Thomas Fuchs</name>
    <email>thomas@fesch.at</email>
  </committer>
</commit>
