Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

eslint: Fix unicorn/prefer-dom-node-dataset.

Anders Kaseorg44f9aaec3251
diff --git a/static/js/drafts.js b/static/js/drafts.js
index 43d93fa2222..2c02bce4b2f 100644
--- a/static/js/drafts.js
+++ b/static/js/drafts.js
@@ -562,7 +562,7 @@ export function drafts_handle_events(e, event_key) {
// This handles when pressing Enter while looking at drafts.
// It restores draft that is focused.
if (event_key === "enter") {
- if (document.activeElement.parentElement.hasAttribute("data-draft-id")) {
+ if (Object.hasOwn(document.activeElement.parentElement.dataset, "draftId")) {
restore_draft(focused_draft_id);
} else {
const first_draft = draft_id_arrow.at(-1);
diff --git a/static/js/lightbox_canvas.js b/static/js/lightbox_canvas.js
index 9bb157a2fc7..5550d9a0a94 100644
--- a/static/js/lightbox_canvas.js
+++ b/static/js/lightbox_canvas.js
@@ -241,7 +241,7 @@ export class LightboxCanvas {
this.context = this.canvas.getContext("2d");
this.meta.image = new Image();
- this.meta.image.src = this.canvas.getAttribute("data-src");
+ this.meta.image.src = this.canvas.dataset.src;
this.meta.image.addEventListener("load", () => {
this.meta.ratio = funcs.imageRatio(this.meta.image);
diff --git a/static/js/popovers.js b/static/js/popovers.js
index 9fd29594dc5..a8b21cab1b3 100644
--- a/static/js/popovers.js
+++ b/static/js/popovers.js
@@ -1235,7 +1235,7 @@ export function register_click_handlers() {
clipboard_enable(".copy_link").on("success", (e) => {
hide_actions_popover();
// e.trigger returns the DOM element triggering the copy action
- const message_id = e.trigger.getAttribute("data-message-id");
+ const message_id = e.trigger.dataset.messageId;
const row = $(`[zid='${CSS.escape(message_id)}']`);
row.find(".alert-msg")
.text($t({defaultMessage: "Copied!"}))