1
Vote

Stack overflow on IE11 with compatibility mode

description

Using hand.js on IE11 with IE10 compatibility mode creates a stack overflow. This error is specific to IE11, because hand.js is correctly working under IE10.

I've found that when you add an event listener to MSPointerMove in this case, the callback will also be called when a event "mousemove" is thrown.

As a result, the function "eventGenerator" in this code is called over and over:
["pointerdown", "pointermove", "pointerup", "pointerover", "pointerout"].forEach(function (eventName) {
    window.addEventListener(nameGenerator(eventName), function (evt) {
        if (!touching && findEventRegisteredNode(evt.target, eventName))
            eventGenerator(evt, eventName, true);
    });
});
Replacing this code by this one make it work on both IE10 and IE11 in compatibility mode.
["pointerdown", "pointermove", "pointerup", "pointerover", "pointerout"].forEach(function (eventName) {
    var name = nameGenerator(eventName);
    window.addEventListener(name, function (evt) {
        if (!touching && findEventRegisteredNode(evt.target, eventName) && evt.type === name)
        eventGenerator(evt, eventName, true);
    });
});
Could you please merge this modification in the code?

comments

SaschaNaz wrote Sep 5, 2014 at 8:19 PM

Great! I'll add it later today. Thank you for your contribution. :)

I actually reported this strange action to IE team but unfortunately this is not yet fixed. :p
https://connect.microsoft.com/IE/feedback/details/813123/addeventlistener-pointermove-works-on-ie10-document-mode-in-ie11

SaschaNaz wrote Sep 6, 2014 at 10:18 AM

Hmm, we still have a problem here. No more stack overflow is there, but IE10 on IE11 still receives normal "pointermove" while it shouldn't. Thus, an event listener will be called twice for one actual event: one generated by IE10 with MSPointerEvent object, and another one generated by HandJS with MouseEvent object.