code improvement

This commit is contained in:
sairaj mote 2023-08-24 04:52:33 +05:30
parent 535634e390
commit c5659f0cb9
2 changed files with 5 additions and 5 deletions

View File

@ -181,7 +181,7 @@ customElements.define('sm-chips', class extends HTMLElement {
this._value = value;
this.assignedElements.forEach(elem => {
if (elem.value == value) {
elem.setAttribute('selected', '');
elem.setAttribute('selected', 'true');
elem.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
}
else
@ -213,7 +213,7 @@ customElements.define('sm-chips', class extends HTMLElement {
this.slotChangeTimeout = setTimeout(() => {
this.assignedElements = slot.assignedElements();
this.assignedElements.forEach(elem => {
if (elem.hasAttribute('selected')) {
if (elem.hasAttribute('selected') && elem.getAttribute('selected') === 'true') {
this._value = elem.value;
}
});
@ -304,7 +304,7 @@ smChip.innerHTML = `
:host(:focus-within) .sm-chip{
box-shadow: 0 0 0 0.1rem var(--accent-color,teal) inset;
}
:host(:hover:not([selected])) .sm-chip{
:host(:hover:not([selected="true"])) .sm-chip{
background-color: rgba(var(--text-color,(17,17,17)), 0.06);
}
.sm-chip{
@ -318,7 +318,7 @@ smChip.innerHTML = `
-webkit-tap-highlight-color: transparent;
background: var(--background,inherit);
}
.sm-chip[selected]{
.sm-chip[selected="true"]{
background-color: var(--accent-color,teal);
color: rgba(var(--background-color, (255,255,255)), 1);
}

File diff suppressed because one or more lines are too long