From c0c349ef2018e141ba6ac1cbaf459d910985d9f3 Mon Sep 17 00:00:00 2001 From: oleg8sh Date: Fri, 8 Aug 2014 02:37:06 +0400 Subject: [PATCH] currentTarget issue in IE8 There is no currentTarget in IE8. So withAttr() fails in it. But 'this' is binded to that already. It's Ok. More info: http://stackoverflow.com/questions/857439/internet-explorer-and-javascript-event-currenttarget http://www.brainjar.com/dhtml/events/default3.asp --- mithril.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mithril.js b/mithril.js index f36a54bb..7f3192b5 100644 --- a/mithril.js +++ b/mithril.js @@ -384,7 +384,8 @@ Mithril = m = new function app(window) { m.withAttr = function(prop, withAttrCallback) { return function(e) { e = e || event - withAttrCallback(prop in e.currentTarget ? e.currentTarget[prop] : e.currentTarget.getAttribute(prop)) + var currentTarget = e.currentTarget || this + withAttrCallback(prop in currentTarget ? currentTarget[prop] : currentTarget.getAttribute(prop)) } }