Skip to content
This repository was archived by the owner on Aug 20, 2023. It is now read-only.

Commit 3e5728e

Browse files
committed
fix(vanillajs-dx-opti): optimize rendering
use approximatly the same code as vanillajs-create-el
1 parent 0b5e21f commit 3e5728e

File tree

1 file changed

+9
-5
lines changed
  • frameworks/keyed/vanillajs-dx-opti/src

1 file changed

+9
-5
lines changed

frameworks/keyed/vanillajs-dx-opti/src/Main.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ rowTemplate.innerHTML = `
1515
<a class="remove">
1616
<span
1717
class="remove glyphicon glyphicon-remove"
18-
aria-hidden="true"></span>
18+
aria-hidden="true"
19+
></span>
1920
</a>
2021
</td>
21-
<td class="col-md-6"></td>`;
22+
<td class="col-md-6"></td>
23+
`.replace(/\s+(?=<)/g, "");
2224
//#endregion row-template
2325

2426
class Store {
@@ -320,10 +322,12 @@ class Main {
320322
}
321323
//#region create-row
322324
createRow(data) {
323-
const tr = rowTemplate.cloneNode(true);
324-
tr.firstElementChild.textContent = data.id;
325-
tr.firstElementChild.nextElementSibling.firstElementChild.textContent = data.label;
325+
const tr = rowTemplate.cloneNode(true),
326+
idElmt = tr.firstChild,
327+
lblElmt = idElmt.nextSibling.firstChild;
326328
tr.data_id = data.id;
329+
idElmt.textContent = data.id;
330+
lblElmt.textContent = data.label;
327331
return tr;
328332
}
329333
//#endregion create-row

0 commit comments

Comments
 (0)