XHTML5 is a common set of XHTML and HTML5, it should be declared with XHTML namespace (xmlns="http://www.w3.org/1999/xhtml"), served with XHTML mime type ("application/xhtml+xml") or opened with ".xhtml" filename extension.
HTML changes to ensure XHTML5 compliance:
modify HTML boolean attributes, e.g. replace selected with selected="selected" or selected=""
XHTML5 is a common set of XHTML and HTML5, it should be declared with XHTML namespace (xmlns="http://www.w3.org/1999/xhtml"), served with XHTML mime type ("application/xhtml+xml") or opened with ".xhtml" filename extension.
HTML changes to ensure XHTML5 compliance:
selected
withselected="selected"
orselected=""
&
in attribute value as&
, avoid use of HTML-specific named entities like
©
<br>
with<br/>
JavaScript changes to avoid potential bugs:
element.tagName
,element.nodeName
with caution since they may be in uppercase for HTML5 but in lowercase for XHTML5document.contentType === 'application/xhtml+xml'
element.innerHTML
, use try...catch and log the html to-be-setKnown locations to be changed:
}&exclude=true"></a>
with}&exclude=true" /></a>
.join('')
for map() return value' selected'
with' selected="selected"'
></input>
with/>
XHTML5 Compliance Test page
test.xhtml