AFASSoftware / maquette

Pure and simple virtual DOM library

Home Page:https://maquettejs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boolean attributes

jadeline opened this issue · comments

If I'm not mistaken, there's seems to be no way to unset a boolean attribute like readonly, see jsfiddle.
Setting it to '', null or undefined keep the attribute with an empty value, true and false are ignored.

What about handling boolean value, true would set the attribute to nothing and false remove it ?

The readonly attribute is a really confusing one. This attribute is an alias for the readOnly boolean property (capital O). Maquette works fine if you use the property, so the line you have to use is h('textarea', {readOnly: readonly}) (where readonly is a boolean variable)

I've totally missed it in the doc, my mistake, thanks for the quick answer.

No problem,
It is a good thing that other people can now find the answer to this common issue.
You could use stackOverflow for questions the next time, that would make the answer visible to more people.