From eaa2e216f4dfe8beaf969b728a76295c3bbeacb8 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 15 Nov 2019 23:23:14 +0100 Subject: [PATCH] Use `for...of` in a couple of loops in `web/toolbar.js` and `web/secondary_toolbar.js` --- web/secondary_toolbar.js | 4 +--- web/toolbar.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js index 11b9fb948..b5252151d 100644 --- a/web/secondary_toolbar.js +++ b/web/secondary_toolbar.js @@ -169,9 +169,7 @@ class SecondaryToolbar { this.toggleButton.addEventListener('click', this.toggle.bind(this)); // All items within the secondary toolbar. - for (let button in this.buttons) { - let { element, eventName, close, eventDetails, } = this.buttons[button]; - + for (const { element, eventName, close, eventDetails, } of this.buttons) { element.addEventListener('click', (evt) => { if (eventName !== null) { let details = { source: this, }; diff --git a/web/toolbar.js b/web/toolbar.js index 9f5ca2224..089c6c3f6 100644 --- a/web/toolbar.js +++ b/web/toolbar.js @@ -201,10 +201,8 @@ class Toolbar { let customScale = Math.round(pageScale * 10000) / 100; this.l10n.get('page_scale_percent', { scale: customScale, }, '{{scale}}%').then((msg) => { - let options = items.scaleSelect.options; let predefinedValueFound = false; - for (let i = 0, ii = options.length; i < ii; i++) { - let option = options[i]; + for (const option of items.scaleSelect.options) { if (option.value !== pageScaleValue) { option.selected = false; continue;