Skip to content

Commit

Permalink
Merge pull request #79 from cdarne/deprecated-jquery-isfunction
Browse files Browse the repository at this point in the history
Replace jQuery.isFunction by a typeof test
  • Loading branch information
usmonster authored Apr 22, 2020
2 parents e2f72ef + 5a99d24 commit 60f430c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions jquery.hoverIntent.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
return out.apply($el[0],[ev]);
};

// checks if `value` is a function
var isFunction = function (value) {
return typeof value === 'function';
};

$.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
// instance ID, used as a key to store and retrieve state information on an element
var instanceId = INSTANCE_COUNT++;
Expand All @@ -100,10 +105,10 @@
var cfg = $.extend({}, _cfg);
if ( $.isPlainObject(handlerIn) ) {
cfg = $.extend(cfg, handlerIn);
if ( !$.isFunction(cfg.out) ) {
if ( !isFunction(cfg.out) ) {
cfg.out = cfg.over;
}
} else if ( $.isFunction(handlerOut) ) {
} else if ( isFunction(handlerOut) ) {
cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
} else {
cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
Expand Down

0 comments on commit 60f430c

Please sign in to comment.