From f1b54847d6c1c4f93c698326b8636d49c16652d8 Mon Sep 17 00:00:00 2001 From: Marek Grzybek Date: Sat, 11 Mar 2017 14:26:48 +0100 Subject: [PATCH] (fix) Use proper event object for handlers in IE `event` and `event.target` are not provided in IE8. This fixes the bugs with not hiding the overlay on background click and not working keyboard shortcuts. --- src/baguetteBox.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/baguetteBox.js b/src/baguetteBox.js index 063a6b73..edce362c 100644 --- a/src/baguetteBox.js +++ b/src/baguetteBox.js @@ -663,7 +663,12 @@ element.addEventListener(event, callback, useCapture); } else { // IE8 fallback - element.attachEvent('on' + event, callback); + element.attachEvent('on' + event, function(event) { + // `event` and `event.target` are not provided in IE8 + event = event || window.event; + event.target = event.target || event.srcElement; + callback(event); + }); } }