Created
February 5, 2018 09:34
-
-
Save L9m/e1668ac3bac7b2ca34dd4f0411285ad0 to your computer and use it in GitHub Desktop.
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
var pfx = ["webkit", "moz", "MS", "o", ""], | |
function PrefixedEvent(element, type, callback) { | |
element.removeEventListener(pfx[p] + type, callback, false); | |
for (var p = 0; p < pfx.length; p++) { | |
if (!pfx[p]) type = type.toLowerCase(); | |
element.addEventListener(pfx[p] + type, callback, false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment