|
@@ -1,9 +1,19 @@
|
|
|
|
|
+import { isBootstrap5 } from './bootstrap-5'
|
|
|
|
|
+
|
|
|
export function disableElement(el) {
|
|
export function disableElement(el) {
|
|
|
- el.setAttribute('disabled', '')
|
|
|
|
|
|
|
+ if (isBootstrap5() && el.tagName.toLowerCase() === 'a') {
|
|
|
|
|
+ el.classList.add('disabled')
|
|
|
|
|
+ } else {
|
|
|
|
|
+ el.disabled = true
|
|
|
|
|
+ }
|
|
|
el.setAttribute('aria-disabled', 'true')
|
|
el.setAttribute('aria-disabled', 'true')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function enableElement(el) {
|
|
export function enableElement(el) {
|
|
|
- el.removeAttribute('disabled')
|
|
|
|
|
|
|
+ if (isBootstrap5() && el.tagName.toLowerCase() === 'a') {
|
|
|
|
|
+ el.classList.remove('disabled')
|
|
|
|
|
+ } else {
|
|
|
|
|
+ el.disabled = false
|
|
|
|
|
+ }
|
|
|
el.removeAttribute('aria-disabled')
|
|
el.removeAttribute('aria-disabled')
|
|
|
}
|
|
}
|