Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created March 16, 2010 01:19
Show Gist options
  • Save cowboy/333531 to your computer and use it in GitHub Desktop.
Save cowboy/333531 to your computer and use it in GitHub Desktop.
(function($){
'$:nomunge'; // Used by YUI compressor.
// Use $.map instead of $.each because the arguments are reversed, allowing
// the function reference to be directly passed as the callback instead of
// requiring an anonymous wrapper function.
$.map(
// All these events will get an "outside" counterpart by default.
'blur focus click dblclick mousedown mouseup mouseover mouseout mouseenter mouseleave keydown keypress keyup'.split(' '),
// Make the $.addOutsideEvent method available publicly while at the same
// time passing a method into $.map. Like many things I do in my plugins,
// this is completely gratuitous, and only done to save a few bytes, but
// hey, if you're reading this comment maybe it'll give you a laugh.
$.addOutsideEvent = jq_addOutsideEvent
);
function jq_addOutsideEvent( event_name ) {
// Do heavy lifting
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment