gitea源码

123456789101112131415161718
  1. import $ from 'jquery';
  2. import {generateElemId} from '../../utils/dom.ts';
  3. export function linkLabelAndInput(label: Element, input: Element) {
  4. const labelFor = label.getAttribute('for');
  5. const inputId = input.getAttribute('id');
  6. if (inputId && !labelFor) { // missing "for"
  7. label.setAttribute('for', inputId);
  8. } else if (!inputId && !labelFor) { // missing both "id" and "for"
  9. const id = generateElemId('_aria_label_input_');
  10. input.setAttribute('id', id);
  11. label.setAttribute('for', id);
  12. }
  13. }
  14. export const fomanticQuery = $;