1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 23:57:29 +02:00

JS: Simplify SubmitHighlight

This commit is contained in:
Jakub Vrana
2025-03-25 06:58:35 +01:00
parent 9b1b779dbd
commit a1080ea8dc

View File

@@ -764,12 +764,10 @@ function eventStop(event) {
* @param HTMLElement * @param HTMLElement
*/ */
function setupSubmitHighlight(parent) { function setupSubmitHighlight(parent) {
for (const key in { input: 1, select: 1, textarea: 1 }) { for (const input of qsa('input, select, textarea', parent)) {
for (const input of qsa(key, parent)) {
setupSubmitHighlightInput(input); setupSubmitHighlightInput(input);
} }
} }
}
/** Setup submit highlighting for single element /** Setup submit highlighting for single element
* @param HTMLElement * @param HTMLElement
@@ -785,20 +783,14 @@ function setupSubmitHighlightInput(input) {
* @this HTMLInputElement * @this HTMLInputElement
*/ */
function inputFocus() { function inputFocus() {
const submit = findDefaultSubmit(this); alterClass(findDefaultSubmit(this), 'default', true);
if (submit) {
alterClass(submit, 'default', true);
}
} }
/** Unhighlight default submit button /** Unhighlight default submit button
* @this HTMLInputElement * @this HTMLInputElement
*/ */
function inputBlur() { function inputBlur() {
const submit = findDefaultSubmit(this); alterClass(findDefaultSubmit(this), 'default');
if (submit) {
alterClass(submit, 'default');
}
} }
/** Find submit button used by Enter /** Find submit button used by Enter