diff options
-rw-r--r-- | bugzillaBugTriage.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index 4c23b90..2c6bc7d 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -881,13 +881,15 @@ BzPage.prototype.parseAttachmentLine = function (inElem) { BzPage.prototype.selectOption = function(id,label) { var sel = this.dok.getElementById(id); var options = Array.filter(sel.getElementsByTagName("option"), - function (x){ return x.value === label; } + function (x){ return x.textContent.trim() == label; } ); theOption = options.length ? options[0] : []; - theOption.selected = true; - var intEvent = this.dok.createEvent("HTMLEvents"); - intEvent.initEvent("change", true, true); - theOption.dispatchEvent(intEvent); + if (theOption) { + theOption.selected = true; + var intEvent = this.dok.createEvent("HTMLEvents"); + intEvent.initEvent("change", true, true); + theOption.dispatchEvent(intEvent); + } }; /** |