From 9920b8080155fb7cbc07e33b4c6a3b6b2e6b9aaf Mon Sep 17 00:00:00 2001 From: Jonathan Dawson Date: Fri, 28 Feb 2020 12:30:02 -0600 Subject: [PATCH] big performance gains by deleting .concat and adding in .push and .flat! --- inject.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inject.js b/inject.js index fb13754..e95ff04 100644 --- a/inject.js +++ b/inject.js @@ -365,17 +365,17 @@ function getShadow(parent) { if (parent.firstElementChild) { var child = parent.firstElementChild; do { - result = result.concat(child); + result.push(child); getChild(child); if (child.shadowRoot) { - result = result.concat(getShadow(child.shadowRoot)); + result.push(getShadow(child.shadowRoot)); } child = child.nextElementSibling; } while (child); } } getChild(parent); - return result; + return result.flat(Infinity); } function getController(id) { return getShadow(document.body).filter(x => {