Fix data attributes written with data-tblr- instead of data-bs- (#3219)

This commit is contained in:
Bartosz-Do authored and GitHub committed 2026-09-25 14:56:00 +02:00
1 parent e3da90ecb6
commit 29818fcc83
4 files changed
+11 -7

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@tabler/core": patch
---
Fixed `Manipulator.setDataAttribute()` writing `data-tblr-*` attributes instead of `data-bs-*`.
+1 -1
View File
@@ -43,7 +43,7 @@ const PREFIXES = ['tblr', 'bs'] as const
const Manipulator = { const Manipulator = {
setDataAttribute(element: HTMLElement, key: string, value: string): void { setDataAttribute(element: HTMLElement, key: string, value: string): void {
element.setAttribute(`data-tblr-${normalizeDataKey(key)}`, value) element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)
}, },
removeDataAttribute(element: HTMLElement, key: string): void { removeDataAttribute(element: HTMLElement, key: string): void {
+4 -4
View File
@@ -20,23 +20,23 @@ describe('Manipulator', () => {
}) })
describe('setDataAttribute', () => { describe('setDataAttribute', () => {
it('should set a data-tblr-* attribute', () => { it('should set a data-bs-* attribute', () => {
Manipulator.setDataAttribute(div, 'key', 'value') Manipulator.setDataAttribute(div, 'key', 'value')
expect(div.getAttribute('data-tblr-key')).toBe('value') expect(div.getAttribute('data-bs-key')).toBe('value')
}) })
it('should convert camelCase keys to kebab-case', () => { it('should convert camelCase keys to kebab-case', () => {
Manipulator.setDataAttribute(div, 'testKey', '123') Manipulator.setDataAttribute(div, 'testKey', '123')
expect(div.getAttribute('data-tblr-test-key')).toBe('123') expect(div.getAttribute('data-bs-test-key')).toBe('123')
}) })
it('should overwrite existing value', () => { it('should overwrite existing value', () => {
Manipulator.setDataAttribute(div, 'key', 'old') Manipulator.setDataAttribute(div, 'key', 'old')
Manipulator.setDataAttribute(div, 'key', 'new') Manipulator.setDataAttribute(div, 'key', 'new')
expect(div.getAttribute('data-tblr-key')).toBe('new') expect(div.getAttribute('data-bs-key')).toBe('new')
}) })
}) })
+1 -2
View File
@@ -660,8 +660,7 @@ Navbar vertical
// The sidebar is rendered for the expanded state, so the active submenu can // The sidebar is rendered for the expanded state, so the active submenu can
// arrive open (.show). Folded, it would paint as a flyout until sidebar.ts // arrive open (.show). Folded, it would paint as a flyout until sidebar.ts
// closes it on DOMContentLoaded — a flicker on every reload. Menus opened by // closes it on DOMContentLoaded — a flicker on every reload. Menus opened by
// the Dropdown plugin carry a popper data attribute (data-tblr-popper from // the Dropdown plugin carry a data-bs-popper attribute, so only the
// tabler.js, data-bs-popper from Bootstrap's own js), so only the
// server-rendered ones hide. // server-rendered ones hide.
.navbar-vertical .dropdown-menu.show:not([data-bs-popper]):not([data-tblr-popper]) { .navbar-vertical .dropdown-menu.show:not([data-bs-popper]):not([data-tblr-popper]) {
display: none; display: none;