Hi,

I would like to propose that Django renders the "checked" attribute of
checkbox and radio inputs using the HTML5 boolean style attributes.

Django has supported HTML5 boolean attributes since 1.8 [0]. It has used
them internally for the "disabled" attribute since 1.9 [1] and the
"required" attribute starting with 1.10 [2]. So there is some precedent to
using the HTML5 style. I find the newer style cleaner and more in line with
modern conventions.

I have created a ticket [3] with this proposal as well as a PR [4].

One concern raised in the ticket is backwards compatibility with non-HTML5
doctypes. I'm not aware of any such issues with modern browsers. I have
tested older doctypes on Firefox and Chrome, both accept the HTML5 boolean
style with HTML4 and XHTML doctypes. Currently, I do not have access to IE,
so I am unable to test those cases. If anyone is interested to test, there
is a very simple test case in the ticket.

Additionally, if there is an issue with older doctypes, presumably this
issue already exists with the disabled and required attributes.

Just reaching out for feedback, concerns, and comments.

Thanks!

Cheers,
Jon


[0] https://docs.djangoproject.com/en/dev/releases/1.8/#forms
[1]
https://github.com/django/django/blob/stable/1.9.x/django/forms/boundfield.py#L88-L89
[2]
https://github.com/django/django/blob/stable/1.10.x/django/forms/boundfield.py#L88-L89
[3] Ticket: https://code.djangoproject.com/ticket/26928
[4] PR: https://github.com/django/django/pull/6961

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CADhq2b6WBJfd0_XWPXPbApdG7KkYAYGNK69joOF3uGgcEvqCFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to