Opened 7 years ago

Closed 6 years ago

#29038 closed Cleanup/optimization (fixed)

Render HTML void elements without a closing slash

Reported by: Jon Dufresne Owned by: nobody
Component: Forms Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In HTML5 syntax, the solidus for void elements is optional and has no effect.

As Django already uses HTML5 specific syntax (e.g. boolean attributes), can take advantage of other HTML5 syntax. Therefore, can render HTML tags without a final solidus.

The HTML5 spec says:

if the element is one of the void elements, or if the element is a foreign element, then there may be a single U+002F SOLIDUS character (/). This character has no effect on void elements

Change History (6)

comment:1 by Jon Dufresne, 7 years ago

comment:2 by Jon Dufresne, 7 years ago

Has patch: set

comment:3 by Tim Graham, 7 years ago

Component: UncategorizedForms
Summary: Render HTML void elements without a solidusRender HTML void elements without a closing slash
Triage Stage: UnreviewedAccepted

comment:4 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: newclosed

In ff05de7:

Fixed #29038 -- Removed closing slash from HTML void tags.

in reply to:  description comment:5 by Nils Fredrik Gjerull, 6 years ago

Resolution: fixed
Status: closednew

This broke my site when I tried to update to Django 2.1. I serve my pages using XHTML serialization of HTML5 which is perfectly valid. That is I server my pages using application/xhtml+xml mimetype. It is unusual, I know, but I prefer the strict syntax checking I get with it. I know XHTML-Strict has gone out of fashion, but HTML5 is not a replacement for XHTML. HTML5 can be served as both application/xhtml+xml and text/html and both are equally valid.

Browser support for xhtml is better than ever, so this is a better time than ever to server pages using xhtml serialization. When XHTML-Strict was viewed as the "way forward" it was effectively stopped by IE not supporting it. This is no longer the case since IE9.

A web framework should have it's html written with polygot markup.

Please revert this changes. I will happily provide a pull-request to make all html in Django into polygot markup.

comment:6 by Tim Graham, 6 years ago

Resolution: fixed
Status: newclosed

We will open a new ticket if the django-developers discussion yields a consensus to revisit this decision.

Note: See TracTickets for help on using tickets.
Back to Top