Open
Description
HTML allows boolean attributes. For example, the HTML code below renders a ticked checkbox.
<input type="checkbox" checked />
In a spark file, the following code always renders the checked
attribute, regardless of what the conditional output should should evaluate to:
<input type="checkbox" value="true" readonly checked="checked?{Model.BooleanProperty}" />
Inspecting the HTML show the view renders like this:
<input type="checkbox" value="true" readonly checked="checked?{Model.BooleanProperty}" />
This would indicate that the view engine trips up on the readonly
attribute without a value and ignore the rest of the line. Explaining why checked=?{...} renders as is. Making the checkbox aways checked.
Changing the spark file to the code below fixes the problem.
<input type="checkbox" value="true" readonly="readonly" checked="checked?{Model.BooleanProperty}" />