|
214 | 214 | } |
215 | 215 |
|
216 | 216 | const SUBTREE_SCAN_LIMIT = 200 |
217 | | - const SUBTREE_SELECTOR = 'script[src], link[href], iframe[src], [id], [class], [data-v-app], [ng-version], astro-island, astro-slot' |
| 217 | + const SUBTREE_SELECTOR = |
| 218 | + 'script[src], link[href], iframe[src], [data-v-app], [ng-version], [data-reactroot], [data-turbo], [data-controller], astro-island, astro-slot' |
218 | 219 |
|
219 | 220 | const matchesSkipContainer = element => { |
220 | 221 | const tokens = [] |
|
342 | 343 | stopped = true |
343 | 344 | clearTimeout(sendTimer) |
344 | 345 | if (pendingMutationFrame) { |
345 | | - if (typeof cancelAnimationFrame === 'function') { |
346 | | - cancelAnimationFrame(pendingMutationFrame) |
| 346 | + if (typeof cancelIdleCallback === 'function') { |
| 347 | + cancelIdleCallback(pendingMutationFrame) |
347 | 348 | } else { |
348 | 349 | clearTimeout(pendingMutationFrame) |
349 | 350 | } |
|
453 | 454 |
|
454 | 455 | const scheduleMutationFlush = () => { |
455 | 456 | if (pendingMutationFrame || stopped) return |
456 | | - if (typeof requestAnimationFrame === 'function') { |
457 | | - pendingMutationFrame = requestAnimationFrame(processPendingMutationNodes) |
| 457 | + if (typeof requestIdleCallback === 'function') { |
| 458 | + pendingMutationFrame = requestIdleCallback(processPendingMutationNodes, { timeout: 1000 }) |
458 | 459 | } else { |
459 | | - pendingMutationFrame = setTimeout(processPendingMutationNodes, 16) |
| 460 | + pendingMutationFrame = setTimeout(processPendingMutationNodes, 200) |
460 | 461 | } |
461 | 462 | } |
462 | 463 |
|
|
484 | 485 | mutationCooldownUntil = now + MUTATION_COOLDOWN_MS |
485 | 486 | pendingMutationNodes = [] |
486 | 487 | if (pendingMutationFrame) { |
487 | | - if (typeof cancelAnimationFrame === 'function') cancelAnimationFrame(pendingMutationFrame) |
| 488 | + if (typeof cancelIdleCallback === 'function') cancelIdleCallback(pendingMutationFrame) |
488 | 489 | else clearTimeout(pendingMutationFrame) |
489 | 490 | pendingMutationFrame = 0 |
490 | 491 | } |
|
517 | 518 | history.pushState = wrappedPushState |
518 | 519 | history.replaceState = wrappedReplaceState |
519 | 520 | window.addEventListener('popstate', handleUrlChange) |
520 | | - navigationInterval = window.setInterval(handleUrlChange, 1200) |
| 521 | + navigationInterval = window.setInterval(handleUrlChange, 5000) |
521 | 522 | } |
522 | 523 |
|
523 | 524 | const installContextInvalidationGuards = () => { |
|
0 commit comments