From bc9a7ef274736c25a695512c82864b82fecb27d4 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 2 May 2024 17:33:16 -0700 Subject: [PATCH] components: Convert .data("tab-id") to .attr. Signed-off-by: Anders Kaseorg --- web/src/components.ts | 2 +- web/tests/components.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/components.ts b/web/src/components.ts index f17b4d2295..fbaabe2abb 100644 --- a/web/src/components.ts +++ b/web/src/components.ts @@ -116,7 +116,7 @@ export function toggle(opts: { } meta.$ind_tab.on("click", function () { - const idx = $(this).data("tab-id"); + const idx = Number($(this).attr("data-tab-id")); select_tab(idx); }); diff --git a/web/tests/components.test.js b/web/tests/components.test.js index 650f219d41..47854ed79a 100644 --- a/web/tests/components.test.js +++ b/web/tests/components.test.js @@ -33,8 +33,8 @@ function make_tab(i) { return tokens.includes(c); }; - $self.data = (name) => { - assert.equal(name, "tab-id"); + $self.attr = (name) => { + assert.equal(name, "data-tab-id"); return i; };