Fork me on GitHub
#hoplon
<
2019-10-10
>
dmarjenburgh21:10:43

Hi, I noticed the following when trying out hoplon. I couldn’t get a checkbox to work as a controlled element. The app state was correct (e.g. todo completed) and the HTML had checked="checked" set, but the checkbox wasn’t marked. Then I learnt the attribute :checked corresponds to the property :defaultChecked and this is was hoplon updates in (input :type "checkbox" :checked completed?). So instead of (.setAttribute elem "checked" true), we need to do (set! elem.checked true) or (aset elem "checked" true). Did anyone encounter the same thing?

flyboarder21:10:44

@dmarjenburgh this depends on your attribute provider

dmarjenburgh21:10:40

I have the default

flyboarder21:10:02

so no attribute provider?

flyboarder21:10:01

Then this is correct behavior, attribute providers generally handle this kind of thing, I recommend using hoplon.jquery as it works well and is stable