Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
calebporzio committed Apr 22, 2024
1 parent 6e670fe commit b9eb50c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/alpinejs/src/directives/x-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ directive('model', (el, { modifiers, expression }, { effect, cleanup }) => {
getInputValue(el, modifiers, { target: el }, getValue())
);
}

// Register the listener removal callback on the element, so that
// in addition to the cleanup function, x-modelable may call it.
// Also, make this a keyed object if we decide to reintroduce
Expand Down Expand Up @@ -150,7 +151,9 @@ function getInputValue(el, modifiers, event, currentValue) {
newValue = event.target.value
}

return event.target.checked ? (currentValue.includes(newValue) ? currentValue : currentValue.concat([newValue])) : currentValue.filter(el => !checkedAttrLooseCompare(el, newValue));
return event.target.checked
? (currentValue.includes(newValue) ? currentValue : currentValue.concat([newValue]))
: currentValue.filter(el => ! checkedAttrLooseCompare(el, newValue));
} else {
return event.target.checked
}
Expand Down

0 comments on commit b9eb50c

Please sign in to comment.