We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a use case where I need to have a default, empty value <option> within a <select> that uses can-value for live-binding.
<option>
<select>
can-value
<script id="tpl" type="text/mustache"> <select can-value="theValue"> <option value="">Choose</option> <option value="1">One</option> <option value="2">Two</option> <option value="3">Three</option> </select> </script>
The data passed to the template has null values by default on the properties that are bound to the <select>s.
null
can.$(document.body).append( can.view('tpl', { theValue: null }) );
It appears that can-live explicitly checks for undefined when determining whether or not to select an <option>
can-live
undefined
https://github.com/bitovi/canjs/blob/master/view/bindings/bindings.js#L182
It would be fantastic if this logic also accommodated null, which it currently does not due to typeof null evaluating as "object".
typeof null
"object"
Code Pen example: http://codepen.io/erikjung/pen/Cvekz
The text was updated successfully, but these errors were encountered:
The commit where the undefined check was added is fdd650c. I agree that we should be doing a == null check here instead.
== null
Sorry, something went wrong.
"" != null
ccummings
No branches or pull requests
I have a use case where I need to have a default, empty value
<option>
within a<select>
that usescan-value
for live-binding.The data passed to the template has
null
values by default on the properties that are bound to the<select>
s.It appears that
can-live
explicitly checks forundefined
when determining whether or not to select an<option>
https://github.com/bitovi/canjs/blob/master/view/bindings/bindings.js#L182
It would be fantastic if this logic also accommodated
null
, which it currently does not due totypeof null
evaluating as"object"
.Code Pen example: http://codepen.io/erikjung/pen/Cvekz
The text was updated successfully, but these errors were encountered: