Permalink
Browse files

GRAILS-3468: Attribute value can be equal to its name

If the attribute value is equal to its name, it will be accepted as
true and will be output.
  • Loading branch information...
1 parent c560bba commit 80d2f7b4ddf8fbacdb998a0042a00e4129678d3a @denisfalqueto committed Jan 27, 2012
@@ -212,8 +212,10 @@ class FormTagLib {
* disabled, readonly and checked.
*/
private void booleanToAttribute(def attrs, String attrName) {
- def attr = attrs.remove(attrName)
- if (attr && Boolean.valueOf(attr)) {
+ def attrValue = attrs.remove(attrName)
+ // 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)
}
}

0 comments on commit 80d2f7b

Please sign in to comment.