From f4f63212b36b79ca2b8a136db8f203285a0b0176 Mon Sep 17 00:00:00 2001 From: Stephan Hohe Date: Sat, 2 Mar 2019 03:17:35 +0100 Subject: [PATCH] Make sure there is data before deleting from it --- jquery.hoverIntent.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jquery.hoverIntent.js b/jquery.hoverIntent.js index 3b9a4b2..765e7e8 100644 --- a/jquery.hoverIntent.js +++ b/jquery.hoverIntent.js @@ -85,7 +85,10 @@ // triggers given `out` function at configured `timeout` after a mouseleave and clears state var delay = function(ev,$el,s,out) { - delete $el.data('hoverIntent')[s.id]; + var data = $el.data('hoverIntent'); + if (data) { + delete data[s.id]; + } return out.apply($el[0],[ev]); };