@@ -1112,19 +1112,25 @@ function _generateActionsFromChanges( oldChildrenLength, changes ) {
1112
1112
for ( const change of changes ) {
1113
1113
// First, fill "holes" between changes with "equal" actions.
1114
1114
if ( change . offset > offset ) {
1115
- actions . push ( ...'e' . repeat ( change . offset - offset ) . split ( '' ) ) ;
1115
+ for ( let i = 0 ; i < change . offset - offset ; i ++ ) {
1116
+ actions . push ( 'e' ) ;
1117
+ }
1116
1118
1117
1119
oldChildrenHandled += change . offset - offset ;
1118
1120
}
1119
1121
1120
1122
// Then, fill up actions accordingly to change type.
1121
1123
if ( change . type == 'insert' ) {
1122
- actions . push ( ...'i' . repeat ( change . howMany ) . split ( '' ) ) ;
1124
+ for ( let i = 0 ; i < change . howMany ; i ++ ) {
1125
+ actions . push ( 'i' ) ;
1126
+ }
1123
1127
1124
1128
// The last handled offset is after inserted range.
1125
1129
offset = change . offset + change . howMany ;
1126
1130
} else if ( change . type == 'remove' ) {
1127
- actions . push ( ...'r' . repeat ( change . howMany ) . split ( '' ) ) ;
1131
+ for ( let i = 0 ; i < change . howMany ; i ++ ) {
1132
+ actions . push ( 'r' ) ;
1133
+ }
1128
1134
1129
1135
// The last handled offset is at the position where the nodes were removed.
1130
1136
offset = change . offset ;
@@ -1143,7 +1149,9 @@ function _generateActionsFromChanges( oldChildrenLength, changes ) {
1143
1149
// Fill "equal" actions at the end of actions set. Use `oldChildrenHandled` to see how many children
1144
1150
// has not been changed / removed at the end of their parent.
1145
1151
if ( oldChildrenHandled < oldChildrenLength ) {
1146
- actions . push ( ...'e' . repeat ( oldChildrenLength - oldChildrenHandled ) . split ( '' ) ) ;
1152
+ for ( let i = 0 ; i < oldChildrenLength - oldChildrenHandled - offset ; i ++ ) {
1153
+ actions . push ( 'e' ) ;
1154
+ }
1147
1155
}
1148
1156
1149
1157
return actions ;
0 commit comments