big performance gains by deleting .concat and adding in .push and .flat!

This commit is contained in:
Jonathan Dawson
2020-02-28 12:30:02 -06:00
parent 201d99c990
commit 9920b80801

View File

@@ -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 => {