Commit f6f78c6e authored by Byron Jones's avatar Byron Jones

Bug 656769: Fix bz_fireEvent for IE9

r=mkanat, a=mkanat
parent 79542d43
...@@ -243,15 +243,16 @@ function bz_optionIndex(aSelect, aValue) { ...@@ -243,15 +243,16 @@ function bz_optionIndex(aSelect, aValue) {
* without the word "on" in front of it. * without the word "on" in front of it.
*/ */
function bz_fireEvent(anElement, anEvent) { function bz_fireEvent(anElement, anEvent) {
// IE if (document.createEvent) {
if (document.createEventObject) { // DOM-compliant browser
var evt = document.createEvent("HTMLEvents");
evt.initEvent(anEvent, true, true);
return !anElement.dispatchEvent(evt);
} else {
// IE
var evt = document.createEventObject(); var evt = document.createEventObject();
return anElement.fireEvent('on' + anEvent, evt); return anElement.fireEvent('on' + anEvent, evt);
} }
// Firefox, etc.
var evt = document.createEvent("HTMLEvents");
evt.initEvent(anEvent, true, true); // event type, bubbling, cancelable
return !anElement.dispatchEvent(evt);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment