1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #14095 from Snuffleupagus/annotationLayer-rm-forEach

Replace a couple of `Array.prototype.forEach`-invocations with `for..of` instead
This commit is contained in:
Jonas Jenwald 2021-10-01 09:55:14 +02:00 committed by GitHub
commit d588f5f961
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1404,12 +1404,11 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
selectElement.addEventListener("updatefromsandbox", jsEvent => {
const actions = {
value(event) {
const options = selectElement.options;
const value = event.detail.value;
const values = new Set(Array.isArray(value) ? value : [value]);
Array.prototype.forEach.call(options, option => {
for (const option of selectElement.options) {
option.selected = values.has(option.value);
});
}
storage.setValue(id, {
value: getValue(event, /* isExport */ true),
});
@ -1478,10 +1477,9 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
},
indices(event) {
const indices = new Set(event.detail.indices);
const options = event.target.options;
Array.prototype.forEach.call(options, (option, i) => {
option.selected = indices.has(i);
});
for (const option of event.target.options) {
option.selected = indices.has(option.index);
}
storage.setValue(id, {
value: getValue(event, /* isExport */ true),
});