diff options
author | Byron Jones <bjones@mozilla.com> | 2012-08-21 10:30:32 +0200 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2012-08-21 10:30:32 +0200 |
commit | 61d045e8ded6bc0de3ec186063634ffde5d2f1c5 (patch) | |
tree | 88d88cf9631402a9fdf8c40524ccf0d73a87ebb5 | |
parent | 2463f83dd807df761e548825e5101b5396b99462 (diff) | |
download | bugzilla-61d045e8ded6bc0de3ec186063634ffde5d2f1c5.tar.gz bugzilla-61d045e8ded6bc0de3ec186063634ffde5d2f1c5.tar.xz |
Bug 781514: Fix breakage when using IE
-rw-r--r-- | js/show_bug.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/js/show_bug.js b/js/show_bug.js index c762f9e54..07276075f 100644 --- a/js/show_bug.js +++ b/js/show_bug.js @@ -15,7 +15,7 @@ function getPreSelectedIndex(el) { } } } - return 0; + return -1; } // Force the browser to honour the selected option when a page is refreshed, @@ -27,12 +27,15 @@ YAHOO.util.Event.onDOMReady(function() { var el_dirty = document.getElementById(el.name + '_dirty'); if (el_dirty) { if (!el_dirty.value) { - el.selectedIndex = getPreSelectedIndex(el); + var preSelectedIndex = getPreSelectedIndex(el); + if (preSelectedIndex != -1) + el.selectedIndex = preselectedIndex; } YAHOO.util.Event.on(el, "change", function(e) { - var el = e.target; + var el = e.target || e.srcElement; var preSelectedIndex = getPreSelectedIndex(el); - document.getElementById(el.name + '_dirty').value = preSelectedIndex == el.selectedIndex ? '' : '1'; + if (preSelectedIndex != -1) + document.getElementById(el.name + '_dirty').value = preSelectedIndex == el.selectedIndex ? '' : '1'; }); } } |