49
49
* replacement node that we’ll swap back in afterwards.
50
50
*/
51
51
52
- import extend from 'extend '
52
+ import structuredClone from '@ungap/structured-clone '
53
53
import { fromParse5 } from 'hast-util-from-parse5'
54
54
import { toParse5 } from 'hast-util-to-parse5'
55
55
import { htmlVoidElements } from 'html-void-elements'
@@ -422,8 +422,6 @@ function resetTokenizer(state, point) {
422
422
setPoint ( state , point )
423
423
424
424
// Process final characters if they’re still there after hibernating.
425
- // Similar to:
426
- // See: <https://github.com/inikulin/parse5/blob/9c683e1/packages/parse5/lib/extensions/location-info/tokenizer-mixin.js#L95>.
427
425
/** @type {CharacterToken } */
428
426
// @ts -expect-error: private.
429
427
// type-coverage:ignore-next-line
@@ -442,7 +440,7 @@ function resetTokenizer(state, point) {
442
440
}
443
441
444
442
// Reset tokenizer:
445
- // See: <https://github.com/inikulin/parse5/blob/edb85df /packages/parse5/lib/tokenizer/index.ts#L225-L249 >.
443
+ // See: <https://github.com/inikulin/parse5/blob/6f7ca60 /packages/parse5/lib/tokenizer/index.ts#L187-L223 >.
446
444
// Especially putting it back in the `data` state is useful: some elements,
447
445
// like textareas and iframes, change the state.
448
446
// See GH-7.
@@ -707,6 +705,6 @@ function createParse5Location(node) {
707
705
*/
708
706
function cloneWithoutChildren ( node ) {
709
707
return 'children' in node
710
- ? extend ( true , { } , { ...node , children : [ ] } )
711
- : extend ( true , { } , node )
708
+ ? structuredClone ( { ...node , children : [ ] } )
709
+ : structuredClone ( node )
712
710
}
0 commit comments