@@ -7,7 +7,7 @@ import { objToNode } from "./fromVirtual"
7
7
8
8
const getFromRoute = (
9
9
node : Element ,
10
- route : number [ ] ,
10
+ route : number [ ]
11
11
) : Element | Text | false => {
12
12
route = route . slice ( )
13
13
while ( route . length > 0 ) {
@@ -20,15 +20,15 @@ const getFromRoute = (
20
20
export function applyDiff (
21
21
tree : Element ,
22
22
diff : diffType ,
23
- options : DiffDOMOptions , // {preDiffApply, postDiffApply, textDiff, valueDiffing, _const}
23
+ options : DiffDOMOptions // {preDiffApply, postDiffApply, textDiff, valueDiffing, _const}
24
24
) {
25
25
const action = diff [ options . _const . action ] as string | number
26
26
const route = diff [ options . _const . route ] as number [ ]
27
27
let node
28
28
29
29
if (
30
30
! [ options . _const . addElement , options . _const . addTextElement ] . includes (
31
- action ,
31
+ action
32
32
)
33
33
) {
34
34
// For adding nodes, we calculate the route later on. It's different because it includes the position of the newly added item.
@@ -56,7 +56,7 @@ export function applyDiff(
56
56
}
57
57
node . setAttribute (
58
58
diff [ options . _const . name ] as string ,
59
- diff [ options . _const . value ] as string ,
59
+ diff [ options . _const . value ] as string
60
60
)
61
61
break
62
62
case options . _const . modifyAttribute :
@@ -65,7 +65,7 @@ export function applyDiff(
65
65
}
66
66
node . setAttribute (
67
67
diff [ options . _const . name ] as string ,
68
- diff [ options . _const . newValue ] as string ,
68
+ diff [ options . _const . newValue ] as string
69
69
)
70
70
if (
71
71
checkElementType ( node , "HTMLInputElement" ) &&
@@ -88,7 +88,7 @@ export function applyDiff(
88
88
node ,
89
89
node . data ,
90
90
diff [ options . _const . oldValue ] as string ,
91
- diff [ options . _const . newValue ] as string ,
91
+ diff [ options . _const . newValue ] as string
92
92
)
93
93
if ( checkElementType ( node . parentNode , "HTMLTextAreaElement" ) ) {
94
94
node . parentNode . value = diff [ options . _const . newValue ] as string
@@ -108,7 +108,7 @@ export function applyDiff(
108
108
node ,
109
109
node . data ,
110
110
diff [ options . _const . oldValue ] as string ,
111
- diff [ options . _const . newValue ] as string ,
111
+ diff [ options . _const . newValue ] as string
112
112
)
113
113
break
114
114
case options . _const . modifyChecked :
@@ -133,19 +133,19 @@ export function applyDiff(
133
133
objToNode (
134
134
diff [ options . _const . newValue ] as nodeType ,
135
135
insideSvg ,
136
- options ,
136
+ options
137
137
) ,
138
- node ,
138
+ node
139
139
)
140
140
break
141
141
}
142
142
case options . _const . relocateGroup :
143
143
nodeArray = Array (
144
- ...new Array ( diff [ options . _const . groupLength ] ) ,
144
+ ...new Array ( diff [ options . _const . groupLength ] )
145
145
) . map ( ( ) =>
146
146
node . removeChild (
147
- node . childNodes [ diff [ options . _const . from ] as number ] ,
148
- ) ,
147
+ node . childNodes [ diff [ options . _const . from ] as number ]
148
+ )
149
149
)
150
150
nodeArray . forEach ( ( childNode , index ) => {
151
151
if ( index === 0 ) {
@@ -169,9 +169,9 @@ export function applyDiff(
169
169
objToNode (
170
170
diff [ options . _const . element ] as nodeType ,
171
171
node . namespaceURI === "http://www.w3.org/2000/svg" ,
172
- options ,
172
+ options
173
173
) ,
174
- node . childNodes [ c ] || null ,
174
+ node . childNodes [ c ] || null
175
175
)
176
176
break
177
177
}
@@ -190,7 +190,7 @@ export function applyDiff(
190
190
const parentRoute = route . slice ( )
191
191
const c : number = parentRoute . splice ( parentRoute . length - 1 , 1 ) [ 0 ]
192
192
newNode = options . document . createTextNode (
193
- diff [ options . _const . value ] as string ,
193
+ diff [ options . _const . value ] as string
194
194
)
195
195
node = getFromRoute ( tree , parentRoute )
196
196
if ( ! node . childNodes ) {
@@ -220,9 +220,9 @@ export function applyDiff(
220
220
export function applyDOM (
221
221
tree : Element ,
222
222
diffs : ( Diff | diffType ) [ ] ,
223
- options : DiffDOMOptions ,
223
+ options : DiffDOMOptions
224
224
) {
225
225
return diffs . every ( ( diff : Diff | diffType ) =>
226
- applyDiff ( tree , diff as diffType , options ) ,
226
+ applyDiff ( tree , diff as diffType , options )
227
227
)
228
228
}
0 commit comments