Ajax.InPlaceEditor seems to call the onComplete callback also when simply cancelling an InPlaceEditor
Reported by Sam Grönblom | September 15th, 2009 @ 09:22 AM
I got an error about an undefined transport (the Ajax.Response object) parameter in my onComplete function for an InPlaceEditor. Since the callback is named onComplete you would assume it would follow the same conventions as the standard Ajax options callbacks. "When used on individual instances, all callbacks (except onException) are invoked with two parameters: the XMLHttpRequest object and the result of evaluating the X-JSON response header, if any (can be null)."
However, when you simply cancel an editor there is no request made and therefore no transport parameter. I noticed that the Ajax.InPlaceEditor calls handleFormCancellation which calls wrapUp which calls _boundComplete. The problem was easily circumvented by just testing if (transport) in my onComplete callback, but it still seems wrong that IPE works this way.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<br/><b>Source available from github</b>
The Git repository resides at:
<br/>Check out the current development trunk with:
<code>git clone git://github.com/madrobby/scriptaculous.git</code>
<br/>As <b>script.aculo.us 1.xx is feature-frozen</b>, this development trunk is for <b>bugfixes only</b>.
<br/>New development should happen only for
<br/><b>Creating a bug report</b>
When creating a bug report, be sure to include as much relevant information as possible. Post a an example that shows off the problem. Preferably, <b>alter the unit tests</b> and show through either changed or added tests how the expected behavior is not occuring.