mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784590 - No onchange event after seleted options by value selector(mozbrowser <select>), r=fabrice
This commit is contained in:
parent
0ec3169d22
commit
8f39d91f36
@ -118,13 +118,28 @@ let FormAssistant = {
|
||||
|
||||
case "Forms:Select:Choice":
|
||||
let options = target.options;
|
||||
let valueChanged = false;
|
||||
if ("index" in json) {
|
||||
options.item(json.index).selected = true;
|
||||
if (options.selectedIndex != json.index) {
|
||||
options.selectedIndex = json.index;
|
||||
valueChanged = true;
|
||||
}
|
||||
} else if ("indexes" in json) {
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
options.item(i).selected = (json.indexes.indexOf(i) != -1);
|
||||
let newValue = (json.indexes.indexOf(i) != -1);
|
||||
if (options.item(i).selected != newValue) {
|
||||
options.item(i).selected = newValue;
|
||||
valueChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only fire onchange event if any selected option is changed
|
||||
if (valueChanged) {
|
||||
let event = content.document.createEvent('HTMLEvents');
|
||||
event.initEvent('change', true, true);
|
||||
target.dispatchEvent(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user