Skip to content

Commit b9805d2

Browse files
committed
Merge branch 'hman61-DooHTML-DOM-v0.92.1-beta'
2 parents 26d4b40 + 41cfbf9 commit b9805d2

File tree

12 files changed

+41
-365
lines changed

12 files changed

+41
-365
lines changed

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

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Doo.define(
2323
this.runLots = this.runLots.bind(this)
2424
this.update = this.update.bind(this)
2525
this.clear = this.clear.bind(this)
26-
this.swaprows = this.swapRows.bind(this)
26+
this.swapRows = this.swapRows.bind(this)
2727
this.addEventListeners()
2828
this.selectedRow = undefined
2929
document.querySelector(".ver").innerHTML += ` ${Doo.version} (keyed)`
@@ -58,20 +58,15 @@ Doo.define(
5858
return data
5959
}
6060
getIndex(row) {
61-
let idx = this.data.rows.findIndex((item, i) => {
62-
if (item.id === row.key) {
63-
return i
64-
}
65-
})
66-
return idx
61+
return this.data.rows.findIndex((item, i) => item.id === row.key)
6762
}
6863

6964
delete(elem) {
7065
let row = this.getParentRow(elem)
7166
if (row) {
7267
let idx = this.getIndex(row)
7368
this.tbody.removeChild(row)
74-
if (idx !== undefined) {
69+
if (idx !== undefined && idx !== -1) {
7570
this.data.rows.splice(idx,1)
7671
}
7772
}
@@ -134,29 +129,28 @@ Doo.define(
134129

135130
this.data.rows[CHILD_1] = this.data.rows[CHILD_998];
136131
this.data.rows[CHILD_998] = row1
137-
this.tbody.insertBefore(swapRow, node1)
138-
this.tbody.insertBefore(node1, node999)
132+
this.tbody.insertBefore(node1.parentNode.replaceChild(swapRow, node1), node999)
139133
}
140134
}
141135

142136
addEventListeners() {
143-
document.getElementById("main").addEventListener('click', e => {
144-
e.preventDefault()
145-
if (e.target.matches('#runlots')) {
146-
this.runLots()
147-
} else if (e.target.matches('#run')) {
148-
this.run()
149-
} else if (e.target.matches('#add')) {
150-
this.add()
151-
} else if (e.target.matches('#update')) {
152-
this.update()
153-
} else if (e.target.matches('#clear')) {
154-
this.clear()
155-
} else if (e.target.matches('#swaprows')) {
156-
this.swapRows()
137+
const actions = {
138+
'run': this.run,
139+
'runlots': this.runLots,
140+
'add': this.add,
141+
'update': this.update,
142+
'clear': this.clear,
143+
'swaprows': this.swapRows,
144+
runAction: (e) => {
145+
e.preventDefault()
146+
if (actions[e.target.id]) {
147+
actions[e.target.id]()
148+
}
157149
}
158-
})
150+
}
151+
document.getElementById("main").addEventListener('click', e => actions.runAction(e))
159152
}
153+
160154
async connectedCallback() {
161155
super.connectedCallback()
162156
}

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

Lines changed: 2 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/keyed/doohtml-dom/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.91.7-beta",
3+
"version": "0.92.1",
44
"description": "DooHTML-DOM (no shadow) JS-Benchmark",
55
"main": "Main.class.js",
66
"js-framework-benchmark": {

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Doo.define(
2626
this.runLots = this.runLots.bind(this)
2727
this.update = this.update.bind(this)
2828
this.clear = this.clear.bind(this)
29-
this.swaprows = this.swapRows.bind(this)
29+
this.swapRows = this.swapRows.bind(this)
3030
this.addEventListeners()
3131
this.selectedRow = undefined
3232
document.querySelector(".ver").innerHTML += ` ${Doo.version} (keyed)`
@@ -143,23 +143,23 @@ Doo.define(
143143
}
144144

145145
addEventListeners() {
146-
document.getElementById("main").addEventListener('click', e => {
147-
e.preventDefault()
148-
if (e.target.matches('#runlots')) {
149-
this.runLots()
150-
} else if (e.target.matches('#run')) {
151-
this.run()
152-
} else if (e.target.matches('#add')) {
153-
this.add()
154-
} else if (e.target.matches('#update')) {
155-
this.update()
156-
} else if (e.target.matches('#clear')) {
157-
this.clear()
158-
} else if (e.target.matches('#swaprows')) {
159-
this.swapRows()
146+
const actions = {
147+
'run': this.run,
148+
'runlots': this.runLots,
149+
'add': this.add,
150+
'update': this.update,
151+
'clear': this.clear,
152+
'swaprows': this.swapRows,
153+
runAction: (e) => {
154+
e.preventDefault()
155+
if (actions[e.target.id]) {
156+
actions[e.target.id]()
157+
}
160158
}
161-
})
159+
}
160+
document.getElementById("main").addEventListener('click', e => actions.runAction(e))
162161
}
162+
163163
async connectedCallback() {
164164
super.connectedCallback()
165165
}

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

Lines changed: 2 additions & 20 deletions
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.91.7-beta",
3+
"version": "0.92.1",
44
"description": "DooHTML JS-Benchmark",
55
"main": "Main.class.js",
66
"js-framework-benchmark": {

frameworks/non-keyed/doohtml/index.html

Lines changed: 0 additions & 61 deletions
This file was deleted.

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

Lines changed: 0 additions & 154 deletions
This file was deleted.

0 commit comments

Comments
 (0)