Files
gitea/web_src/js/modules/fomantic/base.ts
silverwind 69e595cdd8 Update eslint to v9 (#35485)
Update eslint and all plugins. Many plugins still do not ship type
definitions so I had to add stubs. Also, I had to put a few typescript
error expectations because if some unknown error in the types.

`eslint-plugin-no-jquery` is disabled because it's not compatible with
eslint 9 flat config
(https://github.com/wikimedia/eslint-plugin-no-jquery/issues/311).
2025-09-14 19:15:06 +03:00

18 lines
552 B
TypeScript

import $ from 'jquery';
import {generateElemId} from '../../utils/dom.ts';
export function linkLabelAndInput(label: Element, input: Element) {
const labelFor = label.getAttribute('for');
const inputId = input.getAttribute('id');
if (inputId && !labelFor) { // missing "for"
label.setAttribute('for', inputId);
} else if (!inputId && !labelFor) { // missing both "id" and "for"
const id = generateElemId('_aria_label_input_');
input.setAttribute('id', id);
label.setAttribute('for', id);
}
}
export const fomanticQuery = $;