Created
October 27, 2015 16:00
-
-
Save f0i/74e45686fc467e378150 to your computer and use it in GitHub Desktop.
Pass event to m.withAttr callback function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pass event to m.withAttr callback function | |
m.withAttr = function(prop, withAttrCallback) { | |
return function(e) { | |
e = e || event; | |
var currentTarget = e.currentTarget || this; | |
withAttrCallback(prop in currentTarget ? currentTarget[prop] : currentTarget.getAttribute(prop), e); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment