[Form] Rewrite boolean attributes to match HTML spec

'The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value.'

- http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#boolean-attribute
This commit is contained in:
Leevi Graham 2013-04-26 20:06:41 +10:00 committed by Bernhard Schussek
parent e24dbf7cba
commit 8e4c2a7e65

View File

@ -373,15 +373,41 @@
{% block widget_attributes %}
{% spaceless %}
id="{{ id }}" name="{{ full_name }}"{% if read_only %} readonly="readonly"{% endif %}{% if disabled %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif %}
{% for attrname, attrvalue in attr %}{% if attrname in ['placeholder', 'title'] %}{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {% else %}{{ attrname }}="{{ attrvalue }}" {% endif %}{% endfor %}
id="{{ id }}"
name="{{ full_name }}"
{% if read_only %} readonly="readonly"{% endif %}
{% if disabled %} disabled="disabled"{% endif %}
{% if required %} required="required"{% endif %}
{% if max_length %} maxlength="{{ max_length }}"{% endif %}
{% if pattern %} pattern="{{ pattern }}"{% endif %}
{% for attrname, attrvalue in attr %}
{% if attrname in ['placeholder', 'title'] %}
{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
{% else %}
{% if attrvalue is sameas(true) %}
{{ attrname }}="{{ attrname }}"
{% elseif attrvalue is not sameas(false) %}
{{ attrname }}="{{ attrvalue }}"
{% endif %}
{% endif %}
{% endfor %}
{% endspaceless %}
{% endblock widget_attributes %}
{% block widget_container_attributes %}
{% spaceless %}
{% if id is not empty %}id="{{ id }}" {% endif %}
{% for attrname, attrvalue in attr %}{{ attrname }}="{{ attrvalue }}" {% endfor %}
{% for attrname, attrvalue in attr %}
{% if attrname in ['placeholder', 'title'] %}
{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
{% else %}
{% if attrvalue is sameas(true) %}
{{ attrname }}="{{ attrname }}"
{% elseif attrvalue is not sameas(false) %}
{{ attrname }}="{{ attrvalue }}"
{% endif %}
{% endif %}
{% endfor %}
{% endspaceless %}
{% endblock widget_container_attributes %}