4949 * replacement node that we’ll swap back in afterwards.
5050 */
5151
52- import extend from 'extend '
52+ import structuredClone from '@ungap/structured-clone '
5353import { fromParse5 } from 'hast-util-from-parse5'
5454import { toParse5 } from 'hast-util-to-parse5'
5555import { htmlVoidElements } from 'html-void-elements'
@@ -422,8 +422,6 @@ function resetTokenizer(state, point) {
422422 setPoint ( state , point )
423423
424424 // 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>.
427425 /** @type {CharacterToken } */
428426 // @ts -expect-error: private.
429427 // type-coverage:ignore-next-line
@@ -442,7 +440,7 @@ function resetTokenizer(state, point) {
442440 }
443441
444442 // 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 >.
446444 // Especially putting it back in the `data` state is useful: some elements,
447445 // like textareas and iframes, change the state.
448446 // See GH-7.
@@ -707,6 +705,6 @@ function createParse5Location(node) {
707705 */
708706function cloneWithoutChildren ( node ) {
709707 return 'children' in node
710- ? extend ( true , { } , { ...node , children : [ ] } )
711- : extend ( true , { } , node )
708+ ? structuredClone ( { ...node , children : [ ] } )
709+ : structuredClone ( node )
712710}
0 commit comments