embedly/embedly-jquery — pull request #28 by TrevorBurnham (2012-05-03 19:22:16+00:00)
Title: Fixing settings bug

This patch addresses a major source of headaches: The line

settings = $.extend($.embedly.defaults, options);

was 1) overwriting `$.embedly.defaults` each time `$.embedly` was called with options, and 2) using `$.embedly.defaults` directly as the settings. This was causing `options.success` to always point to the *last* `success` callback to be passed to `$.embedly`. So a series of calls like

$.embedly(url, {..., success: callback1});
$.embedly(url, {..., success: callback2});
$.embedly(url, {..., success: callback3});

would result in three calls to `callback3`!

The correct jQuery-ism is to create a new object, `{}`, and use it as the first argument:

settings = $.extend({}, $.embedly.defaults, options);

Highly recommend minifying and doing a version bump after merging, as this is a major bug fix.