Closed martinfitzg closed 9 years ago
Hmm, I'll take a look next week, as this sounds like a bug.
Perhaps it's interpreting "selected" as the name of a property. In that case, as a workaround, adding selected: true
to your widget might help.
Hi Bill, Thanks for that, tried it, but no joy.... I'll leave it with you....
Martin
I looked at it some more. This seems to work:
<option selected value="">hello now</option>
as does this (but the first is preferable since it's standard HTML):
<option selected="true" value="">hello now</option>
The failure is happening because HTMLOption#selected
is a boolean property, and for non-string properties (including boolean properties), handlebars.js will generate code like:
c1c1.selected = selected;
rather than:
c1c1.selected = "selected";
I guess I should add some code so that markup like selected=selected
(and disabled=disabled
, etc.) is treated the same way as selected=true
and disabled=true
.
PS: Hmm, I guess <option selected>
isn't working either. It doesn't throw an exception but it doesn't select the option either. Only <option selected=true>
is currently working.
Regardless, I have a fix that I will check in shortly.
Thanks Bill !!!!
Hello all Creating a very basic widget using handlebars template. When I put the following in the template.
I get the following the error
"Uncaught ReferenceError: selected is not defined"
if I remove the selected attribute from the option all works fine.
Any one got away around this ?