From ae2f45a3f03b642737e5639408b4a6bf189d9aea Mon Sep 17 00:00:00 2001 From: eight Date: Wed, 13 Feb 2019 10:24:41 +0800 Subject: [PATCH] Fix: call Object.keys twice --- content/apply.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/apply.js b/content/apply.js index bed23c39..2c0baa18 100644 --- a/content/apply.js +++ b/content/apply.js @@ -322,13 +322,14 @@ const APPLY = (() => { } function applyStyles(sections) { - if (!Object.keys(sections).length) { + const styles = Object.values(sections); + if (!styles.length) { return Promise.resolve(); } return rootReady().then(() => docRootObserver.evade(() => styleInjector.addMany( - Object.values(sections).map(s => ({id: s.id, code: s.code.join('')})) + styles.map(s => ({id: s.id, code: s.code.join('')})) ) ) );