Skip to content

Commit 63ff3c9

Browse files
committed
Merge branch 'DooHTML-DOM-v0.92.2-beta-april-25-2024' of https://github.com/hman61/js-framework-benchmark into hman61-DooHTML-DOM-v0.92.2-beta-april-25-2024
2 parents 8b79ff4 + ddace9b commit 63ff3c9

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const lenA = adjectives.length, lenB = colours.length, lenC = nouns.length
99
const DEFAULT_SIZE = 1000
1010
const CHILD_1 = 1
1111
const CHILD_998 = 998
12+
const DANGER = 'danger'
1213
Doo.define(
1314
class Main extends Doo {
1415
constructor() {
@@ -95,21 +96,17 @@ Doo.define(
9596

9697
select(elem) {
9798
if (this.selectedRow) {
98-
this.selectedRow.classList.remove('danger')
99+
this.selectedRow.className = ''
99100
this.selectedRow = undefined
100101
}
102+
101103
if (elem) {
102-
this.toggleSelect(this.getParentRow(elem))
103-
}
104-
}
105-
106-
toggleSelect(row) {
107-
if (row) {
108-
row.classList.toggle('danger')
109-
if (row.classList.contains('danger')) {
104+
let row = this.getParentRow(elem)
105+
if (row) {
110106
this.selectedRow = row
111-
}
112-
}
107+
row.className = DANGER
108+
}
109+
}
113110
}
114111

115112
clear() {

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const lenA = adjectives.length, lenB = colours.length, lenC = nouns.length
1111
const DEFAULT_SIZE = 1000
1212
const CHILD_1 = 1
1313
const CHILD_998 = 998
14+
const BANG = ' !!!'
15+
const DANGER = 'danger'
1416

1517
Doo.define(
1618
class Main extends Doo {
@@ -90,28 +92,26 @@ Doo.define(
9092
}
9193

9294
update() {
95+
const bang = ' !!!'
9396
for (let i=0, len = this.data.rows.length;i<len;i+=10) {
94-
this.tbody.childNodes[i].childNodes[1].childNodes[0].innerText = this.data.rows[i].label += ' !!!'
97+
this.data.rows[i].label += BANG
98+
this.tbody.childNodes[i].childNodes[1].childNodes[0].firstChild.textContent = this.data.rows[i].label
9599
}
96100
}
97101

98102
select(elem) {
99103
if (this.selectedRow) {
100-
this.selectedRow.classList.remove('danger')
104+
this.selectedRow.className = ''
101105
this.selectedRow = undefined
102106
}
107+
103108
if (elem) {
104-
this.toggleSelect(this.getParentRow(elem))
105-
}
106-
}
107-
108-
toggleSelect(row) {
109-
if (row) {
110-
row.classList.toggle('danger')
111-
if (row.classList.contains('danger')) {
109+
let row = this.getParentRow(elem)
110+
if (row) {
112111
this.selectedRow = row
113-
}
114-
}
112+
row.className = DANGER
113+
}
114+
}
115115
}
116116

117117
clear() {

0 commit comments

Comments
 (0)