Sonar: Accessing/removing data attributes only through dataset

This commit is contained in:
koloml committed 2026-10-17 05:47:22 +02:00
1 parent ace783afc3
commit 0eafa074f5
3 files changed
+2 -6

No files matched your search

@@ -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 {
@@ -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;
}
/**
@@ -127,7 +127,6 @@ export class TagsForm extends BaseComponent {
const categoryName = tagCategories.get(tagName)!;
tagElement.dataset.tagCategory = categoryName;
tagElement.setAttribute('data-tag-category', categoryName);
}
}