Skip to content

Commit 4c907a7

Browse files
committed
Merge branch 'DooHTML-v0.80.2-keyed-and-non-keyed' of https://github.com/hman61/js-framework-benchmark into hman61-DooHTML-v0.80.2-keyed-and-non-keyed
2 parents b4d3ffd + cf1d91a commit 4c907a7

File tree

6 files changed

+29
-16
lines changed

6 files changed

+29
-16
lines changed

frameworks/keyed/doohtml/js/Main.class.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Doo.define(
9696
add() {
9797
let start = this.data.rows.length
9898
this.data.rows = this.data.rows.concat(this.buildData())
99-
this.append(this.data.rows.slice(start), this.tbody, start)
99+
this.append(this.data.rows, this.tbody, start)
100100
}
101101

102102
runLots() {

frameworks/keyed/doohtml/js/doo.html.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/keyed/doohtml/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-framework-benchmark-doohtml",
3-
"version": "0.60.11",
3+
"version": "0.80.2",
44
"description": "DooHTML JS-Benchmark",
55
"main": "Main.class.js",
66
"js-framework-benchmark": {

frameworks/non-keyed/doohtml/js/Main.class.js

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Doo.define(
7676
add() {
7777
let start = this.data.rows.length
7878
this.data.rows = this.data.rows.concat(this.buildData())
79-
this.append(this.data.rows.slice(start), this.tbody, start)
79+
this.append(this.data.rows, this.tbody, start)
8080
}
8181

8282
runLots() {
@@ -110,22 +110,35 @@ Doo.define(
110110
this.tbody.textContent = ''
111111
}
112112

113+
isRowSelected(elem) {
114+
return elem.classList.contains('danger')
115+
}
113116
swapRows() {
114-
if (this.data.rows.length > 998) {
115-
let node1 = this.tbody.firstChild.nextSibling,
116-
node2 = node1.nextSibling,
117-
node998 = this.tbody.childNodes[998],
118-
node999 = node998.nextSibling,
119-
row1 = this.data.rows[1]
117+
const A=1,B=998
118+
if (this.data.rows.length > B) {
120119

121-
this.data.rows[1] = this.data.rows[998];
122-
this.data.rows[998] = row1
120+
let a = this.tbody.childNodes[A],
121+
b = this.tbody.childNodes[B],
122+
row1 = this.data.rows[1]
123123

124-
this.tbody.insertBefore(node998, node2)
125-
this.tbody.insertBefore(node1, node999)
124+
this.data.rows[A] = this.data.rows[B];
125+
this.data.rows[B] = row1
126+
127+
const selected1 = this.isRowSelected(a)
128+
const selected2 = this.isRowSelected(b)
129+
this.updateRow(A, this.data.rows, this.tbody)
130+
this.updateRow(B, this.data.rows, this.tbody)
131+
132+
if (selected1) {
133+
this.select(this.tbody.childNodes[B])
134+
}
135+
if (selected2) {
136+
this.select(this.tbody.childNodes[A])
137+
}
126138
}
127139
}
128140

141+
129142
addEventListeners() {
130143
document.getElementById("main").addEventListener('click', e => {
131144
e.preventDefault()

frameworks/non-keyed/doohtml/js/doo.html.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/non-keyed/doohtml/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-framework-benchmark-doohtml",
3-
"version": "0.80.1",
3+
"version": "0.60.13",
44
"description": "DooHTML JS-Benchmark",
55
"main": "Main.class.js",
66
"js-framework-benchmark": {

0 commit comments

Comments
 (0)