summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--js/util.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/js/util.js b/js/util.js
index 666f2666b..6dcabbbc9 100644
--- a/js/util.js
+++ b/js/util.js
@@ -243,15 +243,16 @@ function bz_optionIndex(aSelect, aValue) {
* without the word "on" in front of it.
*/
function bz_fireEvent(anElement, anEvent) {
- // IE
- if (document.createEventObject) {
+ if (document.createEvent) {
+ // DOM-compliant browser
+ var evt = document.createEvent("HTMLEvents");
+ evt.initEvent(anEvent, true, true);
+ return !anElement.dispatchEvent(evt);
+ } else {
+ // IE
var evt = document.createEventObject();
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);
}
/**