x-bind:value does not set value attribute for empty strings #2679
|
Hello all, when For example, in the following code, first option would not have value attribute at all. I have checked documentation but did not found anything that could explain this behavior, so I wonder if this is a bug. It looks like this is because empty string is falsy. <select x-model="sortBy">
<template x-for="el in [['','Sort by'],['desc','Desc']]">
<option :value="el[0]" x-text="el[1]"></option>
</template>
</select>I have created minimal use case: Attributes other than Workaround for the case above is to wrap string in String class. |
Replies: 2 comments 3 replies
|
I stumbled across this same issue and can confirm it. |
|
Hmm, yeah, that is incorrect. since no value means the text content is used as the value, while an empty value is an empty value... |
Recently a PR was merged with a fix: #4831