Elegant way to test a plugin in multiple versions of jQuery.
Works perfectly with QUnit (and probably other testing frameworks).
This will test myPlugin.js in version 1.4.3, 1.4.4 and the most recent 1.5.* version.
$versions("1.4.3", "1.4.4", "1.5").load("myCoolPlugin.js").execute(function($, jQuery, version) { // Assuming you are using QUnit: module("myCoolPlugin in jQuery version " + version);
test("Check return values", function() { equals($("<div>").myCoolPlugin(), "foo"); }) });
See http://code.google.com/apis/libraries/devguide.html#jquery (and click on “view older versions”).