From 0eafa074f5af0c57ca4b0cc51cf2dffe15b07fba Mon Sep 17 00:00:00 2001 From: KoloMl Date: Sat, 17 Oct 2026 05:30:00 +0200 Subject: [PATCH] Sonar: Accessing/removing data attributes only through `dataset` --- .../components/extension/profiles/TagsListToggler.ts | 1 - src/content/components/philomena/TagDropdown.ts | 6 ++---- src/content/components/philomena/TagsForm.ts | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/content/components/extension/profiles/TagsListToggler.ts b/src/content/components/extension/profiles/TagsListToggler.ts index c88b564..16a6cef 100644 --- a/src/content/components/extension/profiles/TagsListToggler.ts +++ b/src/content/components/extension/profiles/TagsListToggler.ts @@ -215,7 +215,6 @@ export default class TagsListToggler extends BaseComponent { */ static #markTagElementWithCategory(tagElement: HTMLElement, category: string) { tagElement.dataset.tagCategory = category; - tagElement.setAttribute('data-tag-category', category); } static create(): TagsListToggler { diff --git a/src/content/components/philomena/TagDropdown.ts b/src/content/components/philomena/TagDropdown.ts index 8719281..8786d57 100644 --- a/src/content/components/philomena/TagDropdown.ts +++ b/src/content/components/philomena/TagDropdown.ts @@ -88,14 +88,12 @@ export class TagDropdown extends BaseComponent { // Make sure original category is properly stored. this.originalCategory; - this.container.dataset.tagCategory = targetCategory; - if (targetCategory) { - this.container.setAttribute('data-tag-category', targetCategory); + this.container.dataset.tagCategory = targetCategory; return; } - this.container.removeAttribute('data-tag-category'); + delete this.container.dataset.tagCategory; } /** diff --git a/src/content/components/philomena/TagsForm.ts b/src/content/components/philomena/TagsForm.ts index 8307ed8..58554fd 100644 --- a/src/content/components/philomena/TagsForm.ts +++ b/src/content/components/philomena/TagsForm.ts @@ -127,7 +127,6 @@ export class TagsForm extends BaseComponent { const categoryName = tagCategories.get(tagName)!; tagElement.dataset.tagCategory = categoryName; - tagElement.setAttribute('data-tag-category', categoryName); } }