Skip to content

Commit

Permalink
GRAILS-3468: Attribute value can be equal to its name
Browse files Browse the repository at this point in the history
If the attribute value is equal to its name, it will be accepted as
true and will be output.
  • Loading branch information
denisfalqueto committed Jan 27, 2012
1 parent c560bba commit 80d2f7b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ class FormTagLib {
* disabled, readonly and checked. * disabled, readonly and checked.
*/ */
private void booleanToAttribute(def attrs, String attrName) { private void booleanToAttribute(def attrs, String attrName) {
def attr = attrs.remove(attrName) def attrValue = attrs.remove(attrName)
if (attr && Boolean.valueOf(attr)) { // If the value is the same as the name or if it is a boolean value,
// reintroduce the attribute to the map, so it is output later
if (attrValue && (attrValue == attrName || Boolean.valueOf(attrValue))) {
attrs.put(attrName, attrName) attrs.put(attrName, attrName)
} }
} }
Expand Down

0 comments on commit 80d2f7b

Please sign in to comment.