Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

GRAILS-3468: Better pass-through for non null values

String values not equal to 'false' or 'true' (case insensitive) or null will be passed
changes to the output. This will enhance compatibility with existing code.
  • Loading branch information...
commit 094e02fe2d29e1b7934aa89c6c0dd2562b233073 1 parent d29e99d
@denisfalqueto authored
12 ...lugin-gsp/src/main/groovy/org/codehaus/groovy/grails/plugins/web/taglib/FormTagLib.groovy
@@ -212,12 +212,16 @@ class FormTagLib {
* disabled, readonly and checked.
private void booleanToAttribute(def attrs, String attrName) {
- // We'll not remove the value, so it will be passed along if it's not a boolean
- def attrValue = attrs.get(attrName)
+ 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.equalsIgnoreCase(attrName) || Boolean.valueOf(attrValue))) {
+ // reintroduce the attribute to the map according to the w3c rules, so it is output later
+ if (Boolean.valueOf(attrValue) ||
+ (attrValue instanceof String && attrValue?.equalsIgnoreCase(attrName))) {
attrs.put(attrName, attrName)
+ } else if (attrValue instanceof String && !attrValue?.equalsIgnoreCase('false')) {
+ // If the value is not the string 'false', then we should just pass it on to
+ // keep compatibility with existing code
+ attrs.put(attrName, attrValue)
Please sign in to comment.
Something went wrong with that request. Please try again.