atatchevent,detachevent not working in ie11
i have checked that in the attach event and detach event,the both is showing object not found as there is no event like that in ie11.
i have fixed that issue .
please check if the fix is appropriate.
(function() {
if (AW.ie) {
AW.attachEvent = function(element, name, handler) {
if (element.attachEvent) {
return element.attachEvent(name, handler);
} else if (element.addEventListener) {
return element.addEventListener(name.replace(/^on/, ""), handler);
}
};
AW.detachEvent = function(element, name, handler) {
if (element.detachEvent) {
return element.detachEvent(name, handler)
} else if (element.removeEventListener) {
return element.removeEventListener(name.replace(/^on/, ""), handler);
}
};
AW.srcElement = function(event) {
if (event) {
return event.srcElement
}
};
AW.toElement = function(event) {
if (event) {
return event.toElement
}
};
AW.setReturnValue = function(event, value) {
if (event) {
event.returnValue = value
}
};
AW.setCapture = function(element) {
return element.setCapture()
};
AW.releaseCapture = function(element) {
return element.releaseCapture()
};
AW.addRule = function(stylesheet, selector, rule) {
return stylesheet.addRule(selector, rule)
};
AW.getRules = function(stylesheet) {
return stylesheet.rules
};
AW.setOuterHTML = function(element, html) {
element.outerHTML = html
};
AW.createXMLHttpRequest = function() {
try {
return new ActiveXObject("MSXML2.XMLHTTP")
} catch (err) {}
try {
return new ActiveXObject("Microsoft.XMLHTTP")
} catch (err) {}
try {
return new XMLHttpRequest
} catch (err) {}
};
AW.getLeft = function(element) {
return element.getBoundingClientRect().left
};
AW.getTop = function(element) {
return element.getBoundingClientRect().top
}
}
})();
i have fixed that issue .
please check if the fix is appropriate.
(function() {
if (AW.ie) {
AW.attachEvent = function(element, name, handler) {
if (element.attachEvent) {
return element.attachEvent(name, handler);
} else if (element.addEventListener) {
return element.addEventListener(name.replace(/^on/, ""), handler);
}
};
AW.detachEvent = function(element, name, handler) {
if (element.detachEvent) {
return element.detachEvent(name, handler)
} else if (element.removeEventListener) {
return element.removeEventListener(name.replace(/^on/, ""), handler);
}
};
AW.srcElement = function(event) {
if (event) {
return event.srcElement
}
};
AW.toElement = function(event) {
if (event) {
return event.toElement
}
};
AW.setReturnValue = function(event, value) {
if (event) {
event.returnValue = value
}
};
AW.setCapture = function(element) {
return element.setCapture()
};
AW.releaseCapture = function(element) {
return element.releaseCapture()
};
AW.addRule = function(stylesheet, selector, rule) {
return stylesheet.addRule(selector, rule)
};
AW.getRules = function(stylesheet) {
return stylesheet.rules
};
AW.setOuterHTML = function(element, html) {
element.outerHTML = html
};
AW.createXMLHttpRequest = function() {
try {
return new ActiveXObject("MSXML2.XMLHTTP")
} catch (err) {}
try {
return new ActiveXObject("Microsoft.XMLHTTP")
} catch (err) {}
try {
return new XMLHttpRequest
} catch (err) {}
};
AW.getLeft = function(element) {
return element.getBoundingClientRect().left
};
AW.getTop = function(element) {
return element.getBoundingClientRect().top
}
}
})();
shuaib kunhabdulla
October 13,