Skip to content

Commit 4b324cc

Browse files
authored
refactor(devtools): modernize MouseEvent initialization (#2930)
* fix(devtools): replace deprecated MouseEvent initialization with modern constructor * fix(docs): add missing comma in theme index.ts
1 parent 0282296 commit 4b324cc

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

packages/docs/.vitepress/theme/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const theme: Theme = {
2727
'aside-ads-before': () => h(AsideSponsors),
2828
// 'layout-top': () => h(VuejsdeConfBanner),
2929
'doc-before': () => h(TranslationStatus, { status, i18nLabels }),
30-
'layout-top': () => h(MadVueBanner)
30+
'layout-top': () => h(MadVueBanner),
3131
})
3232
},
3333

packages/pinia/src/devtools/file-saver.ts

+16-18
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,22 @@ function click(node: Element) {
6868
try {
6969
node.dispatchEvent(new MouseEvent('click'))
7070
} catch (e) {
71-
const evt = document.createEvent('MouseEvents')
72-
evt.initMouseEvent(
73-
'click',
74-
true,
75-
true,
76-
window,
77-
0,
78-
0,
79-
0,
80-
80,
81-
20,
82-
false,
83-
false,
84-
false,
85-
false,
86-
0,
87-
null
88-
)
71+
const evt = new MouseEvent('click', {
72+
bubbles: true,
73+
cancelable: true,
74+
view: window,
75+
detail: 0,
76+
screenX: 80,
77+
screenY: 20,
78+
clientX: 80,
79+
clientY: 20,
80+
ctrlKey: false,
81+
altKey: false,
82+
shiftKey: false,
83+
metaKey: false,
84+
button: 0,
85+
relatedTarget: null,
86+
})
8987
node.dispatchEvent(evt)
9088
}
9189
}

0 commit comments

Comments
 (0)