@@ -27,8 +27,7 @@ Doo.define(
27
27
this . addEventListeners ( )
28
28
this . selectedRow = undefined
29
29
document . querySelector ( ".ver" ) . innerHTML += ` ${ Doo . version } (non-keyed)`
30
- document . title += ` ${ Doo . version } (non-keyed)`
31
- }
30
+ document . title += ` ${ Doo . version } (non-keyed)` }
32
31
33
32
async dooAfterRender ( ) {
34
33
this . tbody = this . shadow . querySelector ( '#tbody' )
@@ -68,25 +67,30 @@ Doo.define(
68
67
69
68
run ( ) {
70
69
this . data . rows = this . buildData ( )
70
+ if ( this . tbody . childNodes . length > this . data . rows . length ) {
71
+ this . tbody . textContent = ''
72
+ }
71
73
this . renderTable ( )
74
+
72
75
}
73
76
74
77
add ( ) {
75
78
let startRow = this . data . rows . length
76
79
this . data . rows = this . data . rows . concat ( this . buildData ( ) )
77
80
this . renderTable ( this . data . rows , startRow )
78
- }
81
+ }
79
82
80
83
runLots ( ) {
81
84
this . data . rows = this . buildData ( 10000 )
85
+ if ( this . tbody . childNodes . length > this . data . rows . length ) {
86
+ this . tbody . textContent = ''
87
+ }
82
88
this . renderTable ( )
83
89
}
84
90
85
91
update ( ) {
86
- let tr = this . tbody . querySelectorAll ( 'tr' )
87
92
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 += ' !!!'
90
94
}
91
95
}
92
96
@@ -118,7 +122,6 @@ Doo.define(
118
122
119
123
this . tbody . insertBefore ( node2 , node1 )
120
124
this . tbody . insertBefore ( node1 , this . tbody . childNodes [ 999 ] )
121
-
122
125
}
123
126
}
124
127
0 commit comments