]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
refactor(devtools): modernize MouseEvent initialization (#2930)
authorNaoki Haba <59875779+NaokiHaba@users.noreply.github.com>
Thu, 6 Mar 2025 13:07:18 +0000 (22:07 +0900)
committerGitHub <noreply@github.com>
Thu, 6 Mar 2025 13:07:18 +0000 (14:07 +0100)
* fix(devtools): replace deprecated MouseEvent initialization with modern constructor

* fix(docs): add missing comma in theme index.ts

packages/docs/.vitepress/theme/index.ts
packages/pinia/src/devtools/file-saver.ts

index 3913807e1d330a9fe4233aadc6a0a8771a5c1b67..42ac5ebafd30aa8b3e0778a7cef8d6ff3a471a8a 100644 (file)
@@ -27,7 +27,7 @@ const theme: Theme = {
       'aside-ads-before': () => h(AsideSponsors),
       // 'layout-top': () => h(VuejsdeConfBanner),
       'doc-before': () => h(TranslationStatus, { status, i18nLabels }),
-      'layout-top': () => h(MadVueBanner)
+      'layout-top': () => h(MadVueBanner),
     })
   },
 
index 69a8ed5bfdc630990907e3ab8184ad2788b4bfa2..c928fa0b39fb7248a6af7bf47ac6a52e68dacc13 100644 (file)
@@ -68,24 +68,22 @@ function click(node: Element) {
   try {
     node.dispatchEvent(new MouseEvent('click'))
   } catch (e) {
-    const evt = document.createEvent('MouseEvents')
-    evt.initMouseEvent(
-      'click',
-      true,
-      true,
-      window,
-      0,
-      0,
-      0,
-      80,
-      20,
-      false,
-      false,
-      false,
-      false,
-      0,
-      null
-    )
+    const evt = new MouseEvent('click', {
+      bubbles: true,
+      cancelable: true,
+      view: window,
+      detail: 0,
+      screenX: 80,
+      screenY: 20,
+      clientX: 80,
+      clientY: 20,
+      ctrlKey: false,
+      altKey: false,
+      shiftKey: false,
+      metaKey: false,
+      button: 0,
+      relatedTarget: null,
+    })
     node.dispatchEvent(evt)
   }
 }