Created
September 14, 2013 16:28
-
-
Save x1024/6563378 to your computer and use it in GitHub Desktop.
Initial(and untested) version of a polyfill aiming to normalize IE10/IE11 pointer events.
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
// | |
// Sources: | |
// | |
// http://benalman.com/news/2010/03/jquery-special-events/ | |
// http://learn.jquery.com/events/event-extensions/ | |
// https://github.com/jquery/jquery/blob/master/src/event.js#L549 | |
// https://github.com/jquery/jquery/blob/master/src/event.js#L694 | |
var useOldStyleEvents = window.navigator.msPointerEnabled; | |
if (useOldStyleEvents) { | |
// Add all appropriate events here, properly capitalized | |
var events = ['PointerDown'] | |
for (i in events) { | |
var ev = events[i]; | |
var oldEv = 'MS' + ev; | |
var newEv = ev.toLowerCase(); | |
// Simulate the new-style event, but delegate it to the old-style one. | |
$.event.special[newEv] = { | |
bindType = oldEv, | |
delegateType = oldEv | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah, I did not know that. Yes, you are correct.