Bug with IE 11 and "detachEvent" function in dhthmlxmenu.js

Hi,

I’m using IE11, with dhtml 3.6.

The new version of dhthmlxmenu.js for IE11 workaround (dhtmlx.com/blog/dhtmlx-hot-f … available/) give me an error in the unload function (line 1869) :

I don’t know why, but this code don’t work with IE:

	if (_isIE) {
		document.body.detachEvent("onclick", this._bodyClick);
		document.body.detachEvent("oncontextmenu", this._bodyContext);
	} else {
		window.removeEventListener("click", this._bodyClick, false);
		window.removeEventListener("contextmenu", this._bodyContext, false);
	}

The error is

document.body.detachEvent(“onclick”, this._bodyClick);
L’objet ne gère pas la propriété ou la méthode « detachEvent »

When I search the code, I found this (line 812):

	if (typeof(window.addEventListener) != "undefined") {
		window.addEventListener("click", this._bodyClick, false);
		window.addEventListener("contextmenu", this._bodyContext, false);
	} else {
		document.body.attachEvent("onclick", this._bodyClick);
		document.body.attachEvent("oncontextmenu", this._bodyContext);
	}

so i decide to remplace the wrong code with this:

	if (typeof(window.addEventListener) != "undefined") {
		window.removeEventListener("click", this._bodyClick, false);
		window.removeEventListener("contextmenu", this._bodyContext, false);
	} else {
		document.body.detachEvent("onclick", this._bodyClick);
		document.body.detachEvent("oncontextmenu", this._bodyContext);
	}

and I works fine now, both on IE11 and FF

Can you confirm that’s this correction is good ?

By advance, thanks.

Hi

yep, I can confirm - your correction is good. we already have similar in latest 3.6 build. you can open ticket in a supoprt system and request latest build if any.