From 835dcd41f2f6fc3695d92bb12f20fb19b463e4c4 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 6 Nov 2018 16:20:44 -0200 Subject: [PATCH] code review for 7d100f7b21a9: just the very slow opportunistic walk toward full ES6 code base --- src/js/scriptlets/element-picker.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/js/scriptlets/element-picker.js b/src/js/scriptlets/element-picker.js index 741daedba..734d43be6 100644 --- a/src/js/scriptlets/element-picker.js +++ b/src/js/scriptlets/element-picker.js @@ -764,9 +764,8 @@ var filterToDOMInterface = (function() { return; } const out = []; - let iElem = elems.length; - while ( iElem-- ) { - out.push({ type: 'cosmetic', elem: elems[iElem]}); + for ( const elem of elems ) { + out.push({ type: 'cosmetic', elem }); } return out; }; @@ -1584,9 +1583,7 @@ var startPicker = function(details) { const attr = srcAttrMap[tagName]; if ( attr === undefined ) { return; } const elems = document.getElementsByTagName(tagName); - let i = elems.length; - while ( i-- ) { - const elem = elems[i]; + for ( const elem of elems ) { if ( elem === pickerRoot ) { continue; } const src = elem[attr]; if ( typeof src !== 'string' ) { continue; }