Skip to content

Commit

Permalink
chore: add element title & css classes only when defined (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding authored Nov 4, 2023
1 parent adcc33d commit 8b16b5d
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions lib/src/MultipleSelectInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ export class MultipleSelectInstance {
: createDomElement('input', {
type: 'checkbox',
dataset: { name: this.selectGroupName, key: row._key },
ariaChecked: String(row.selected),
ariaChecked: String(row.selected || false),
checked: row.selected,
disabled: row.disabled,
});
Expand Down Expand Up @@ -565,18 +565,27 @@ export class MultipleSelectInstance {
return [createDomElement('li', { className: 'option-divider' })];
}

const liElm = createDomElement('li', {
title,
className: multiple || classes ? (multiple + classes).trim() : '',
});
const liClasses = multiple || classes ? (multiple + classes).trim() : '';
const liElm = document.createElement('li');
if (liClasses) {
liElm.className = liClasses;
}
if (title) {
liElm.title = title;
}
applyParsedStyleToElement(liElm, style);

const labelElm = createDomElement('label', { className: `${row.disabled ? 'disabled' : ''}` });
const labelClasses = `${row.disabled ? 'disabled' : ''}`;
const labelElm = document.createElement('label');
if (labelClasses) {
labelElm.className = labelClasses;
}

const inputElm = createDomElement('input', {
type,
value: encodeURI(row.value),
dataset: { key: row._key, name: this.selectItemName },
ariaChecked: String(row.selected),
ariaChecked: String(row.selected || false),
checked: Boolean(row.selected),
disabled: Boolean(row.disabled),
});
Expand Down

0 comments on commit 8b16b5d

Please sign in to comment.