You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Select options behaving differently in Vue 3 than Vue 2 #3475
As we can see if you have more than 4 <option>s, Vue's compiler will try to stringify static nodes for performance reasons. So when you have 5 <option>s, the first <option> is stringified into "<option value=\"null\">Not set</option>" so we are experiencing the current issue.
There seems to be another bug that <option :value="null"> is rendered as <option value> when not taking the optimization path as for Vue 3 we have taken a new strategy for attribute coercion and the expected output should be <option> as null values for an attribute now indicates the attribute should be removed.
Though #3477 may fix that null values were rendered as "null", the difference between Vue 2 and 3 still exists and is intentional.
And there's still an issue to be investigated that <option :value="null"> is rendered as <option value="">, which does not comply with our latest coercion behavior.
Activity
Justineo commentedon Mar 24, 2021
https://github.com/vuejs/vue-next/blob/eb1fae63f926435fb0eef890663d24e09d4c79e1/packages/compiler-dom/src/transforms/stringifyStatic.ts#L73-L85
As we can see if you have more than 4
<option>s, Vue's compiler will try to stringify static nodes for performance reasons. So when you have 5<option>s, the first<option>is stringified into"<option value=\"null\">Not set</option>"so we are experiencing the current issue.Template Explorer →
Justineo commentedon Mar 24, 2021
There seems to be another bug that
<option :value="null">is rendered as<option value>when not taking the optimization path as for Vue 3 we have taken a new strategy for attribute coercion and the expected output should be<option>asnullvalues for an attribute now indicates the attribute should be removed.Justineo commentedon Mar 24, 2021
Though #3477 may fix that
nullvalues were rendered as"null", the difference between Vue 2 and 3 still exists and is intentional.And there's still an issue to be investigated that
<option :value="null">is rendered as<option value="">, which does not comply with our latest coercion behavior.fix(compiler-dom): stringifyStatic should remove attribute bindings w…