Slight refactoring and tests

Uses Jasmine and a spy to ensure the callback is only executed when
the browser is in compatibility mode. The logic for determining
compatibility mode is wrapped in a function so it can be stubbed out in
tests.

Feel free to use this, or discard it. I mostly did this for fun because I wanted to see how hard it would be to test jquery plugins. :)