lesjames/Breakpoint — pull request #29 by skibblenybbles (2012-12-18 04:25:19+00:00)
Title: rewrote breakpoint plugin to handle edge cases robustly and to be a good memory citizen

Here's a stab at a more robust jQuery plugin. It implements the same API as your plugin, but:

* You can now register event handlers to monitor changes to the breakpoint label with `$("body").bind("breakpoint", function(evt) { ... }`, and the passed `evt` object will have a `breakpoint` property set to the current breakpoint label.
* The callback function is passed the original image as its `this` context and two arguments: the breakpoint name and the calculated image URL
* The image is not set to `display: none;` because this would be more appropriate for the callback to decide based on whether the calculated image URL is `null`. This also does not preclude having a hook to fade the image in or out using either jQuery animation or CSS3 transitions by appending a class to the image.
* The plugin makes a valiant effort to be a good memory citizen by unregistering handlers on `$(document).unload(...)`.
* The plugin tries to handle all the corner cases robustly, such as registering the same DOM node twice with `$(...).breakpoint(...)`.
* The plugin can be used before `$(document).ready(...)`, just as soon as you can perform a DOM query for the responsive image tags.