Skip to content

Commit 1a53645

Browse files
committed
Merge branch 'master' into dependabot/npm_and_yarn/frameworks/non-keyed/aurelia/aurelia-path-1.1.7
2 parents 7b7cff0 + 280097d commit 1a53645

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+5596
-5038
lines changed

Chrome_Results.ods

388 Bytes
Binary file not shown.

README.md

Lines changed: 92 additions & 63 deletions
Large diffs are not rendered by default.

frameworks/keyed/aurelia/package-lock.json

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

frameworks/keyed/aurelia/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"aurelia-metadata": "1.0.4",
2929
"aurelia-pal": "1.8.0",
3030
"aurelia-pal-browser": "1.8.0",
31-
"aurelia-path": "1.1.1",
31+
"aurelia-path": "1.1.7",
3232
"aurelia-task-queue": "1.3.1",
3333
"aurelia-templating": "1.8.2",
3434
"aurelia-templating-binding": "1.4.3",

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

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
'use strict';
1+
'use strict'
22

3-
const _random = ((max) => {
4-
return Math.round(Math.random()*1000)%max;
5-
})
3+
const _random = max => Math.random() * max | 0
64

7-
const adjectives = ["pretty", "large", "big", "small", "tall", "short", "long", "handsome", "plain", "quaint", "clean", "elegant", "easy", "angry", "crazy", "helpful", "mushy", "odd", "unsightly", "adorable", "important", "inexpensive", "cheap", "expensive", "fancy"];
8-
const colours = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"];
9-
const nouns = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"];
5+
const adjectives = ["pretty", "large", "big", "small", "tall", "short", "long", "handsome", "plain", "quaint", "clean", "elegant", "easy", "angry", "crazy", "helpful", "mushy", "odd", "unsightly", "adorable", "important", "inexpensive", "cheap", "expensive", "fancy"]
6+
const colours = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"]
7+
const nouns = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"]
108

119
const lenA = adjectives.length, lenB = colours.length, lenC = nouns.length
1210

@@ -35,25 +33,25 @@ Doo.define(
3533
async dooAfterRender() {
3634
this.tbody = this.shadow.querySelector('#tbody')
3735
this.shadow.querySelector(this.scrollTarget).addEventListener('click', e => {
38-
e.preventDefault();
36+
e.preventDefault()
3937
if (e.target.parentElement.matches('.remove')) {
40-
this.delete(e.target.parentElement);
38+
this.delete(e.target.parentElement)
4139
} else if (e.target.tagName === 'A') {
42-
this.select(e.target);
40+
this.select(e.target)
4341
}
44-
});
42+
})
4543
}
4644

4745
getParentRow(elem) {
4846
while (elem) {
4947
if (elem.tagName === "TR") {return elem}
50-
elem = elem.parentNode;
48+
elem = elem.parentNode
5149
}
52-
return undefined;
50+
return undefined
5351
}
5452

5553
buildData(count = 1000) {
56-
const data = [];
54+
const data = []
5755
for (let i = 0; i < count; i++) {
5856
data.push({id: this.ID++,label: adjectives[_random(lenA)] + " " + colours[_random(lenB)] + " " + nouns[_random(lenC)]})
5957
}
@@ -69,36 +67,32 @@ Doo.define(
6967
}
7068

7169
run() {
70+
this.clear()
7271
this.data.rows = this.buildData()
73-
this.tbody.textContent = ''
7472
this.renderTable()
7573
}
7674

7775
add() {
78-
let startRow = this.data.rows.length
7976
this.data.rows = this.data.rows.concat(this.buildData())
80-
this.appendData(this.tbody, startRow)
77+
this.renderTable(this.data.rows)
8178
}
8279

8380
runLots() {
81+
this.clear()
8482
this.data.rows = this.buildData(10000)
85-
this.tbody.textContent = ''
8683
this.renderTable()
8784
}
8885

89-
update() {
90-
let tr = this.tbody.querySelectorAll('tr')
86+
update(e) {
9187
for (let i=0, len = this.data.rows.length;i<len;i+=10) {
92-
this.data.rows[i].label += ' !!!';
93-
tr[i].childNodes[1].childNodes[0].textContent = this.data.rows[i].label
88+
this.tbody.childNodes[i].childNodes[1].childNodes[0].innerText = this.data.rows[i].label += ' !!!'
9489
}
9590
}
9691

9792
select(elem) {
9893
if (this.selectedRow) {
9994
this.selectedRow.classList.remove('danger')
10095
this.selectedRow = undefined
101-
// return should toggle IMO
10296
}
10397
let row = this.getParentRow(elem)
10498
if (row) {
@@ -117,8 +111,8 @@ Doo.define(
117111
let node1 = this.tbody.childNodes[1]
118112
let node2 = this.tbody.childNodes[998]
119113

120-
let row1 = this.data.rows[1];
121-
this.data.rows[1] = this.data.rows[998];
114+
let row1 = this.data.rows[1]
115+
this.data.rows[1] = this.data.rows[998]
122116
this.data.rows[998] = row1
123117

124118
this.tbody.insertBefore(node2, node1)
@@ -129,19 +123,19 @@ Doo.define(
129123

130124
addEventListeners() {
131125
document.getElementById("main").addEventListener('click', e => {
132-
e.preventDefault();
126+
e.preventDefault()
133127
if (e.target.matches('#runlots')) {
134-
this.runLots(e);
128+
this.runLots()
135129
} else if (e.target.matches('#run')) {
136-
this.run(e);
130+
this.run()
137131
} else if (e.target.matches('#add')) {
138-
this.add(e);
132+
this.add()
139133
} else if (e.target.matches('#update')) {
140-
this.update();
134+
this.update()
141135
} else if (e.target.matches('#clear')) {
142-
this.clear();
136+
this.clear()
143137
} else if (e.target.matches('#swaprows')) {
144-
this.swapRows();
138+
this.swapRows()
145139
}
146140
})
147141
}

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

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

frameworks/keyed/doohtml/templates/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<template>
33
<table class="table table-hover table-striped test-data">
44
<link href="${link}" rel="stylesheet">
5-
<tbody id="tbody"><tr bind="rows" key="{{i()}}"><td class="col-md-1">{{id}}</td><td class="col-md-4"><a>{{label}}</a></td><td class="col-md-1"><a class="remove"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></td><td class="col-md-6"></td></tr></tbody>
5+
<tbody id="tbody"><tr bind="rows"><td class="col-md-1">{{id}}</td><td class="col-md-4"><a>{{label}}</a></td><td class="col-md-1"><a class="remove"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></td><td class="col-md-6"></td></tr></tbody>
66
</table>
77
</template>

frameworks/non-keyed/doohtml/index.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<meta charset="UTF-8">
5-
<title>DooHTML</title>
6-
<link href="/css/currentStyle.css" rel="preload" as="style"/>
7-
<link href="/css/currentStyle.css" rel="stylesheet"/>
8-
<link href="./js/doo.html.min.js" rel="preload" as="script"/>
9-
<script src="./js/doo.html.min.js"></script>
10-
11-
<script type="module" src="./js/Main.class.js" defer ></script>
4+
<meta charset="UTF-8">
5+
<title>DooHTML</title>
6+
<link href="/css/currentStyle.css" rel="preload" as="style"/>
7+
<link href="/css/currentStyle.css" rel="stylesheet"/>
8+
<link href="./js/doo.html.min.js" rel="preload" as="script"/>
9+
<script src="./js/doo.html.min.js"></script>
10+
<script type="module" src="./js/Main.class.js" defer ></script>
1211
</head>
1312
<body>
1413
<div id="main">

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ Doo.define(
2727
this.addEventListeners()
2828
this.selectedRow = undefined
2929
document.querySelector(".ver").innerHTML += ` ${Doo.version} (non-keyed)`
30-
document.title += ` ${Doo.version} (non-keyed)`
31-
}
30+
document.title += ` ${Doo.version} (non-keyed)` }
3231

3332
async dooAfterRender() {
3433
this.tbody = this.shadow.querySelector('#tbody')
@@ -68,25 +67,30 @@ Doo.define(
6867

6968
run() {
7069
this.data.rows = this.buildData()
70+
if (this.tbody.childNodes.length > this.data.rows.length) {
71+
this.tbody.textContent = ''
72+
}
7173
this.renderTable()
74+
7275
}
7376

7477
add() {
7578
let startRow = this.data.rows.length
7679
this.data.rows = this.data.rows.concat(this.buildData())
7780
this.renderTable(this.data.rows, startRow)
78-
}
81+
}
7982

8083
runLots() {
8184
this.data.rows = this.buildData(10000)
85+
if (this.tbody.childNodes.length > this.data.rows.length) {
86+
this.tbody.textContent = ''
87+
}
8288
this.renderTable()
8389
}
8490

8591
update() {
86-
let tr = this.tbody.querySelectorAll('tr')
8792
for (let i=0, len = this.data.rows.length;i<len;i+=10) {
88-
this.data.rows[i].label += ' !!!';
89-
tr[i].childNodes[1].childNodes[0].textContent = this.data.rows[i].label
93+
this.tbody.childNodes[i].childNodes[1].childNodes[0].innerText = this.data.rows[i].label += ' !!!'
9094
}
9195
}
9296

@@ -118,7 +122,6 @@ Doo.define(
118122

119123
this.tbody.insertBefore(node2, node1)
120124
this.tbody.insertBefore(node1, this.tbody.childNodes[999])
121-
122125
}
123126
}
124127

0 commit comments

Comments
 (0)