Fix JS code style

This commit is contained in:
Michael Weimann 2022-12-23 19:15:03 +01:00
parent 2bab370221
commit 43993aaba5
No known key found for this signature in database
GPG Key ID: 34F0524D4DA694A1
1 changed files with 12 additions and 4 deletions

View File

@ -115,15 +115,23 @@ ready(() => {
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled#overview} * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled#overview}
*/ */
const DISABLE_ELEMENTS = [ const DISABLE_ELEMENTS = [
'button', 'command', 'fieldset', 'input', 'keygen', 'optgroup', 'option', 'select', 'textarea' 'button',
'command',
'fieldset',
'input',
'keygen',
'optgroup',
'option',
'select',
'textarea',
]; ];
ready(() => { ready(() => {
// get all input-radio's and add for each an onChange event listener // get all input-radio's and add for each an onChange event listener
document.querySelectorAll('input[type="radio"]').forEach((radioElement) => { document.querySelectorAll('input[type="radio"]').forEach((radioElement) => {
// build selector and get all corrsponding elements for this input-radio // build selector and get all corrsponding elements for this input-radio
const selector = DISABLE_ELEMENTS.map((tagName) => ( const selector = DISABLE_ELEMENTS.map(
`${tagName}[data-radio-name="${radioElement.name}"][data-radio-value]` (tagName) => `${tagName}[data-radio-name="${radioElement.name}"][data-radio-value]`
)).join(','); ).join(',');
const elements = Array.from(document.querySelectorAll(selector)); const elements = Array.from(document.querySelectorAll(selector));
// set all states one time on init for each of the corresponding elements // set all states one time on init for each of the corresponding elements