Skip to content

Commit

Permalink
Replace dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 6, 2023
1 parent 0c022bd commit 4389c8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 4 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* replacement node that we’ll swap back in afterwards.
*/

import extend from 'extend'
import structuredClone from '@ungap/structured-clone'
import {fromParse5} from 'hast-util-from-parse5'
import {toParse5} from 'hast-util-to-parse5'
import {htmlVoidElements} from 'html-void-elements'
Expand Down Expand Up @@ -422,8 +422,6 @@ function resetTokenizer(state, point) {
setPoint(state, point)

// Process final characters if they’re still there after hibernating.
// Similar to:
// See: <https://github.com/inikulin/parse5/blob/9c683e1/packages/parse5/lib/extensions/location-info/tokenizer-mixin.js#L95>.
/** @type {CharacterToken} */
// @ts-expect-error: private.
// type-coverage:ignore-next-line
Expand All @@ -442,7 +440,7 @@ function resetTokenizer(state, point) {
}

// Reset tokenizer:
// See: <https://github.com/inikulin/parse5/blob/edb85df/packages/parse5/lib/tokenizer/index.ts#L225-L249>.
// See: <https://github.com/inikulin/parse5/blob/6f7ca60/packages/parse5/lib/tokenizer/index.ts#L187-L223>.
// Especially putting it back in the `data` state is useful: some elements,
// like textareas and iframes, change the state.
// See GH-7.
Expand Down Expand Up @@ -707,6 +705,6 @@ function createParse5Location(node) {
*/
function cloneWithoutChildren(node) {
return 'children' in node
? extend(true, {}, {...node, children: []})
: extend(true, {}, node)
? structuredClone({...node, children: []})
: structuredClone(node)
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
"dependencies": {
"@types/hast": "^3.0.0",
"extend": "^3.0.0",
"@ungap/structured-clone": "^1.0.0",
"hast-util-from-parse5": "^8.0.0",
"hast-util-to-parse5": "^8.0.0",
"html-void-elements": "^3.0.0",
Expand All @@ -49,6 +49,7 @@
},
"devDependencies": {
"@types/node": "^20.0.0",
"@types/ungap__structured-clone": "^0.3.0",
"c8": "^8.0.0",
"hast-util-to-html": "^8.0.0",
"hastscript": "^8.0.0",
Expand Down

0 comments on commit 4389c8f

Please sign in to comment.