From 1a87ce0f7c6799a39e0207c01a50346c84c7a311 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 28 Dec 2009 00:56:25 +0100 Subject: Fix selectOption ... there actually IS too much .value replacing .textContent :) --- bugzillaBugTriage.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'bugzillaBugTriage.js') 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); + } }; /** -- cgit