The Full HTML5.2 DTD, like former versions, is a transcription of WHATWG's HTML specification prose into an SGML DTD. If follows WHATWG snapshots as published by W3C (WHATWG itself doesn't publish stable snapshots of its specifications). The Full DTD covers all elements of HTML, SVG, MathML, and the ARIA attributes, and its construction is described in the reference for the W3C HTML 5 DTD, with only modifications for version 5.2 described in this document.
The Minimal HTML5.2 DTD,
also like former versions, is a compact DTD containing
only essential parsing rules for HTML.
As only HTML's special rules for HTML void elements and
enumerated attributes are included (others being admitted
freely), the Minimal HTML5.2's DTD
usefulness for validation purposes is limited. Instead, the
purpose of the Minimal HTML5.2 DTD is to provide a
minimal bundled declaration set for content parsing and
production tasks for modern and idiomatic HTML in sgmljs.net
and other SGML software with support for resolving
declaration sets via catalog resolution (in sgmljs.net,
the Minimal HTML5.2 DTD is resolved and accessed by
the about:legacy-compat
system identifier).
According to the W3C HTML 5.2 recommendation text
At time of publication of this document, patches from the WHATWG HTML specification have been merged until January 12, 2016
Moreover,
The W3C HTML editors have also added patches that resulted from discussions and decisions made by the W3C Web Platform WG as well a bug fixes from bugs not shared by the WHATWG.
(for example, the revised content models for dt
, allowing div
as child element introduced into WHATWG with
https://github.com/w3c/html/commit/ec2e514d525e7a7191d0287bf5b48a02f4d28312
).
The W3C HTML5.2 recommendation documents their changes versus prior versions in Changes. The following subsections describe particular changes.
This W3C HTML 5.2 DTD reflects changes made to W3C's latest
HTML recommendation. For the Minimal DTD variant,
element declarations for all elements that can be
nested are added to block IMPLYDEF ELEMENT ANYOTHER
inferring an end-element if a nested element occurs.
This W3C HTML incorporates an SVG DTD derived from
the official SVG 1.1 2nd edition DTD, updated with support
for the vector-effect
attribute with its only permitted value
non-scaling-stroke
from SVG 1.2 using the SVG 1.1 2nd
editions extensive customization features. This is in line
with the W3C HTML 5.2 HTML specification text stating that
[...] the SVG specifications do not reflect implementation reality. Implementations implement subsets of SVG 1.1 and SVG Tiny 1.2. Although it is hoped that the in-progress SVG 2 specification is a more realistic target for implementations, until that specification is ready, user agents that implement SVG must do so with the following willful violations and additions. [...]
The Minimal DTD for HTML 5.2 now also contains
declaration for SVG elements (but not attributes) to
block SGML's interpretation of undeclared elements
under IMPLYDEf ELEMENT ANYOTHER
semantics (which would
make SGML auto-close undeclared element such as SVG's
g
element when encountering a nested g
element).
The keygen
element has been removed from the
HTML 5.2 version. Note that, unlike other removed
elements, the keygen
element is an SGML element
with declared content EMPTY
(a HTML void element),
hence shouldn't be used with an end-element tag.
The presence of elements with special parsing
rules, however, requires a declaration for thse,
hence the keygen
element is not removed from
the Minimal HTML 5.2 DTD.
The menu
and menuitem
elements are removed,
and this is reflected in updated content models
and element-category parameter entities throughout.
The 'menuitem, like the
keygenelement, has
been incorporated as a legacy element with declared
content
EMPTY` into the Minimal DTD.
The dialog
element has been added.
As reflected by changed DTD code text
the contextmenu
global attribute and the
oncontextmenu
event handler attribute have been
removed
the dropzone
global element has been
removed
the oncopy
and oncut
event handler attributes
have been removed
the onauxclick
and onloadend
event handler attributes have
been added.
Global attributes are declared via a parameter entity reference now that the specification text no longer specifies these individually on every element.
The window or body event handler attributes, used to be specified separately in previous specifications, are now specified along with the body element. The following window event handler attributes are added:
onlagnguagechange
ununhandledrejection
The updated grammar rules admit div
elements
as child content of dl
elements (and seems to allow
"inheriting" dd
and dt
content tokens into child div
elements, similar to "transparent content"), when in
older HTML grammar rules the content model of dl
could be seen to infer/force dt
elements. But actually,
both dt
and dd
require start-element tags in both
W3C HTML 5.1 and 5.2, so no inference opportunity is lost.
The schema change has a related change to the
div
element which is now required to
have dt, dd
pairs when the div
element itself
appears as direct child content of a dl
element. This is, however, not completely reflected
in the updated HTML 5.2 DTD; the 'divelement
instead admits
dtand
dl` elements anywhere in addition
to flow elements (via a content model inclusion).
The legend
element now admits h1
, ..., h6
elements
as child element.
The colgroup
element admits start- and end-tag omission
under specific conditions; this is reflected in the
HTML 5.2 DTD's tag omission indicator for the colgroup
eleement.
The referrerpolicy
attribute has been added to the a
,
img
, iframe
, area
, and link
elements.
The longdesc
attribute has been added to the img
element.
The allowpaymentrequest
attribute has been added to
the iframe
element.
The srcset
, sizes
, and media
attributes have been
added to the source
element.
The new value dialog
has been added to the method
attribute
of the form
element.
The autocomplete
attribute has been added to the select
element.
The inputmode
attribute has been added to the textarea
element.
The declaration of header
and footer
elements as
given in previous DTD transcriptions for W3C HTML 5
and 5.1 didn't admit nested header
or footer
elements,
respectively, when those are allowed by the specification text, eg.
... with no [...] header, footer elements that are not descendants of sectioning content wich is a descendant of the header [or footer, resp.]
is saying that child header
or footer
elements
are only allowed within the child content of header
or
footer
relements, resp., when these are in turn part of a
child sectioning root (ie. not directly as child).
This can't be represented by exclusion exceptions, but must be declared by stating all directly admittted child elements (flow elements without header and footer elements) directly in a content model.
The following additional change was applied in March, 2023 (see also notes for HTML Review Draft 200129):
In previous DTDs, the ARIA role
attribute wasn't actually declared
(only attributes for ARIA states and properties were). This has been
fixed. Note unlike role
, the tabindex
attribute is, and has always
been, declared as part of HTML.
In previous versions, exclusion exceptions for the main
element
had been placed on div
and legend
elements when they should only
apply to sectioning elements with explicit exclusion of main
such as
article
, nav
, and aside
. Note main
itself doesn't exclude main
descendants in its content model.