From 31ad84fccb88ddb0c49b058360b3c3572f25935a Mon Sep 17 00:00:00 2001 From: TylorS Date: Mon, 7 Dec 2015 06:03:25 -0500 Subject: [PATCH] perf(): Remove Array.prototype.slice.call Remove use of Array.prototype.slice.call() for a more performant use of a for-loop. --- src/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index c0c9578..5478cf7 100644 --- a/src/index.js +++ b/src/index.js @@ -102,7 +102,11 @@ function makeElementSelector(rootElem$) { return [element] } else { let nodeList = element.querySelectorAll(scopedSelector) - return Array.prototype.slice.call(nodeList) + const nodeListArray = new Array(nodeList.length) + for (let j = 0; j < nodeListArray.length; j++) { + nodeListArray[j] = nodeList[j] + } + return nodeListArray } } ),