[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:
parent
e24dbf7cba
commit
8e4c2a7e65
@ -373,15 +373,41 @@
|
|||||||
|
|
||||||
{% block widget_attributes %}
|
{% block widget_attributes %}
|
||||||
{% spaceless %}
|
{% 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 %}
|
id="{{ id }}"
|
||||||
{% for attrname, attrvalue in attr %}{% if attrname in ['placeholder', 'title'] %}{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {% else %}{{ attrname }}="{{ attrvalue }}" {% endif %}{% endfor %}
|
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 %}
|
{% endspaceless %}
|
||||||
{% endblock widget_attributes %}
|
{% endblock widget_attributes %}
|
||||||
|
|
||||||
{% block widget_container_attributes %}
|
{% block widget_container_attributes %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% if id is not empty %}id="{{ id }}" {% endif %}
|
{% 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 %}
|
{% endspaceless %}
|
||||||
{% endblock widget_container_attributes %}
|
{% endblock widget_container_attributes %}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user