@@ -195,24 +195,24 @@ export default class MutationBuffer {
195
195
let ancestorBad = false ;
196
196
const missingParents = new Set < Node > ( ) ;
197
197
while ( this . addedSet . size ) {
198
- if ( n !== null && this . addedSet . has ( n . previousSibling ) ) {
198
+ if ( n !== null && this . addedSet . has ( n . previousSibling as Node ) ) {
199
199
// reuse parentNode, parentId, ancestorBad
200
200
nextSibling = n ; // n is a good next sibling
201
- n = n . previousSibling ;
201
+ n = n . previousSibling as Node ;
202
202
} else {
203
- n = this . addedSet . values ( ) . next ( ) . value ; // pop
203
+ n = this . addedSet . values ( ) . next ( ) . value as Node ; // pop
204
204
205
205
while ( true ) {
206
206
parentNode = dom . parentNode ( n ) ;
207
- if ( this . addedSet . has ( parentNode ) ) {
207
+ if ( this . addedSet . has ( parentNode as Node ) ) {
208
208
// start at top of added tree so as not to serialize children before their parents (parentId requirement)
209
- n = parentNode ;
209
+ n = parentNode as Node ;
210
210
continue ;
211
211
}
212
212
break ;
213
213
}
214
214
215
- if ( missingParents . has ( parentNode ) ) {
215
+ if ( missingParents . has ( parentNode as Node ) ) {
216
216
parentNode = null ;
217
217
} else if ( parentNode ) {
218
218
// we have a new parentNode for a 'row' of DOM children
@@ -233,9 +233,9 @@ export default class MutationBuffer {
233
233
234
234
while ( true ) {
235
235
nextSibling = n . nextSibling ;
236
- if ( this . addedSet . has ( nextSibling ) ) {
236
+ if ( this . addedSet . has ( nextSibling as Node ) ) {
237
237
// keep going as we can't serialize a node before it's next sibling (nextId requirement)
238
- n = nextSibling ;
238
+ n = nextSibling as Node ;
239
239
continue ;
240
240
}
241
241
break ;
@@ -258,7 +258,7 @@ export default class MutationBuffer {
258
258
259
259
this . addedSet . delete ( n ) ; // don't re-iterate
260
260
261
- if ( ! parentNode || parentId === - 1 ) {
261
+ if ( ! parentNode || parentId === - 1 || parentId === null ) {
262
262
missingParents . add ( n ) ; // ensure any added child nodes can also early-out
263
263
continue ;
264
264
} else if ( ancestorBad ) {
@@ -316,9 +316,12 @@ export default class MutationBuffer {
316
316
currentN as HTMLLinkElement ,
317
317
) ;
318
318
}
319
- if ( hasShadowRoot ( n ) ) {
319
+ if ( hasShadowRoot ( n as Node ) ) {
320
320
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
321
- this . shadowDomManager . addShadowRoot ( dom . shadowRoot ( n ) ! , this . doc ) ;
321
+ this . shadowDomManager . addShadowRoot (
322
+ dom . shadowRoot ( n as Node ) ! ,
323
+ this . doc ,
324
+ ) ;
322
325
}
323
326
} ,
324
327
onIframeLoad : ( iframe , childSn ) => {
0 commit comments