FancyBox onCleanup not working

Today faced a bug on my pet project where part of the form was not sent to server, thus breaking save record functionality.

After an hour of investigation traced issue back to FancyBox not firing onCleanup where I bring inputs back from FancyBox to the form they belong:
$.fancybox({
    content: $("#RecordAttributes"),
    onCleanup: function () {
        $("#RecordAttributes").appendTo(SvgEditor.Form);
        $("#RecordAttributes").hide();
    }
});
Tried to yield plugin some time before sending form, just in case it intends to call onCleanup asynchronously - nothing helped.
Last resort was to jump to FancyBox sources to immediately realize that API canged and now the callback is called beforeClose.

Adopting the change sorted an issue:
$.fancybox({    content: $("#RecordAttributes"),    beforeClose: function () {        ...    }});
So now my users are happy and me earned some sleep. Cheers

Comments