Skip to content

Commit 127a488

Browse files
committed
Refactor to use structuredClone polyfill
1 parent 40e1d29 commit 127a488

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/footer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @typedef {import('./state.js').State} State
66
*/
77

8+
import structuredClone from '@ungap/structured-clone'
89
import {normalizeUri} from 'micromark-util-sanitize-uri'
910

1011
/**
@@ -110,8 +111,7 @@ export function footer(state) {
110111
type: 'element',
111112
tagName: state.footnoteLabelTagName,
112113
properties: {
113-
// To do: use structured clone.
114-
...JSON.parse(JSON.stringify(state.footnoteLabelProperties)),
114+
...structuredClone(state.footnoteLabelProperties),
115115
id: 'footnote-label'
116116
},
117117
children: [{type: 'text', value: state.footnoteLabel}]

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"dependencies": {
3737
"@types/hast": "^3.0.0",
3838
"@types/mdast": "^4.0.0",
39+
"@ungap/structured-clone": "^1.0.0",
3940
"devlop": "^1.0.0",
4041
"mdast-util-definitions": "^6.0.0",
4142
"micromark-util-sanitize-uri": "^2.0.0",
@@ -45,6 +46,7 @@
4546
},
4647
"devDependencies": {
4748
"@types/node": "^20.0.0",
49+
"@types/ungap__structured-clone": "^0.3.0",
4850
"c8": "^8.0.0",
4951
"hast-util-to-html": "^8.0.4",
5052
"hastscript": "^7.0.0",

0 commit comments

Comments
 (0)