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

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-01-24 14:48:18 -08:00 committed by Tim Abbott
parent 392676d4da
commit 44f9aaec32
3 changed files with 3 additions and 3 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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!"}))