From 0309dbb00e8e05b0348c2eb8d3f2151aa2b2c1de Mon Sep 17 00:00:00 2001 From: Oliver Gerlich Date: Mon, 16 Jul 2018 22:26:40 +0200 Subject: [PATCH] list perf: use documentFragment to add all rows to table in one operation --- webroot/js/view/list.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webroot/js/view/list.js b/webroot/js/view/list.js index 9b44ed4..8c38b51 100644 --- a/webroot/js/view/list.js +++ b/webroot/js/view/list.js @@ -430,10 +430,11 @@ export class ListView extends View { nodes = nodes.reverse(); } + var fragment = document.createDocumentFragment(); for (let i = 0; i < nodes.length; i += 1) { const row = this.renderRow(nodes[i]); - - this.tbody.appendChild(row); + fragment.appendChild(row); } + this.tbody.appendChild(fragment); } }