Closed mva closed 11 years ago
Happy to take the pull request, but can we move the (when v ..) around the entire case statement. I don't think anyone wants to deal with logically false values.
Makes sense. In this case add-class! sets nil or adds a space, and style-str produces an empty string. They don't break, but they do not any useful work either.
HTML attributes that have a value are considered logically true, even if the value is the empty string. The prior code translates an element like
[:option {:selected false} ...]
to<option selected="false">
, which the browser interprets as true.Omitting the attribute altogether if the value is logically false (i.e. false or nil) fixes this.
Note: this pull request only touches
template/add-attr!
,template-compile
may require a similar change.