From 043e7225fd216c9dfbe2b16599cfce94dcd171d2 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 75bac2e..5bb5d57 100644 --- a/webroot/js/view/list.js +++ b/webroot/js/view/list.js @@ -410,10 +410,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); } }