Skip to content

Commit c5b1e0b

Browse files
committed
Merge branch 'hville-master'
2 parents b656ed1 + 9a5f011 commit c5b1e0b

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

frameworks/keyed/attodom/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ var Store = require('./src/store'),
55

66
var view = View(new Store)
77
view.update()
8-
98
document.body.appendChild(view)

frameworks/keyed/attodom/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "js-framework-benchmark-attodom-v0.9.0",
3-
"version": "0.9.0",
4-
"description": "Benchmark for attoDom 0.9.0",
2+
"name": "js-framework-benchmark-attodom",
3+
"version": "0.11.3",
4+
"description": "Benchmark for attodom",
55
"js-framework-benchmark": {
66
"frameworkVersionFromPackage": "attodom"
77
},
@@ -22,6 +22,6 @@
2222
"uglify-js": "3.0.12"
2323
},
2424
"dependencies": {
25-
"attodom": "0.9.0"
25+
"attodom": "^0.11.3"
2626
}
2727
}

frameworks/keyed/attodom/src/view.js

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,55 @@
11
/*eslint indent: ["warn", 2, { "VariableDeclarator": 2 }]*/
22
var h = require('attodom/el'),
3-
list = require('attodom/list'),
4-
t = require('attodom/text')
3+
list = require('attodom/list')
54

6-
var TITLE = 'attodom v0.9.0'
5+
var TITLE = 'attodom v0.11.3'
76

87
module.exports = function(store) {
98
function clickHandlerMenu(e) {
109
var key = e.target.id
1110
if (key) {
1211
e.preventDefault()
1312
store[key === 'runlots' ? 'runLots' : key === 'swaprows' ? 'swapRows' : key]()
14-
rows.update(store.data)
13+
rowList.update(store.data)
1514
}
1615
}
16+
1717
function updateRow(v) {
1818
this.$label.data = v.label
1919
this.className = (this.id === store.selected) ? 'danger' : ''
2020
}
21-
function clickHandlerSelect(e) {
22-
e.preventDefault()
23-
store.select(this.parentNode.id)
24-
rows.update(store.data)
25-
}
26-
function clickHandlerDelete(e) {
27-
e.preventDefault()
28-
store.delete(+this.parentNode.id)
29-
rows.update(store.data)
30-
}
3121

32-
var rows = list('id', function(rec) {
33-
var attr = {id: rec.id, update: updateRow, $label: t(rec.label)}
22+
function makeRow(rec) {
23+
var attr = {id: rec.id, update: updateRow}
3424
return h('tr', attr,
3525
h('td', {class: 'col-md-1'}, rec.id),
36-
h('td', {class: 'col-md-4', onclick: clickHandlerSelect},
37-
h('a', {class: 'lbl'}, attr.$label)
26+
h('td', {class: 'col-md-4', onClick: clickHandlerSelect},
27+
h('a', {class: 'lbl'}, attr.$label = document.createTextNode(rec.label))
3828
),
39-
h('td', {class: 'col-md-1', onclick: clickHandlerDelete},
29+
h('td', {class: 'col-md-1', onClick: clickHandlerDelete},
4030
h('a', {class: 'remove'},
4131
h('span', {class: 'glyphicon glyphicon-remove remove', 'aria-hidden': ''})
4232
)
4333
),
4434
h('td', {class: 'col-md-6'})
4535
)
46-
})
36+
}
37+
38+
function clickHandlerSelect(e) {
39+
e.preventDefault()
40+
store.select(this.parentNode.id)
41+
rowList.update(store.data)
42+
}
4743

48-
return h('div', {id: 'main', update: function() { rows.update(store.data) }},
44+
function clickHandlerDelete(e) {
45+
e.preventDefault()
46+
store.delete(+this.parentNode.id)
47+
rowList.update(store.data)
48+
}
49+
50+
var rowList = list(h('tbody', {id: 'tbody'}), makeRow, {key: 'id'})
51+
52+
return h('div', {id: 'main', update: function() { rowList.update(store.data) }},
4953
h('div', {class: 'container'},
5054
h('div', {class: 'jumbotron'},
5155
h('div', {class: 'row'},
@@ -64,9 +68,7 @@ module.exports = function(store) {
6468
)
6569
)
6670
),
67-
h('table', {class: 'table table-hover table-striped test-data'},
68-
h('tbody', {id: 'tbody'}, rows)
69-
),
71+
h('table', {class: 'table table-hover table-striped test-data'}, rowList.parent),
7072
h('span', {class: 'preloadicon glyphicon glyphicon-remove', 'aria-hidden': ''})
7173
)
7274
)

0 commit comments

Comments
 (0)