From 5b05ee79ffe6f79fe2ae84a9b9943067e3270d3d Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 19 Mar 2021 15:48:31 -0400 Subject: [PATCH] cssmanager: Simplify iteration over style sheets --- src/static/js/cssmanager.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/static/js/cssmanager.js b/src/static/js/cssmanager.js index 0fcdad403..9d6f277ed 100644 --- a/src/static/js/cssmanager.js +++ b/src/static/js/cssmanager.js @@ -40,13 +40,8 @@ const makeCSSManager = (emptyStylesheetTitle, doc) => { } else { throw new Error('Unknown dynamic style container'); } - const allSheets = win.document.styleSheets; - - for (let i = 0; i < allSheets.length; i++) { - const s = allSheets[i]; - if (s.title === title) { - return s; - } + for (const s of win.document.styleSheets) { + if (s.title === title) return s; } return null; };