HTML5 defines some HTML attributes as boolean; a boolean can only be true
or false
. The specification simply states that the presence of a boolean attribute implies that the attribute is set to true. In example using a disabled
attribute in the following example disables the button input element:
<input disabled type="button" value="HTML Button">
XML, and therefore XHTML by extension, must have a valid attribute and value. Because HTML5 is not written in a fashion to clarify such things (ambiguity in past standards has led to differing browser implementations) HTML5 attributes when served in an XHTML application should always use a true
value, at least until a future specification removes the unnecessary ambiguity.
<input disabled="true" type="button" value="XHTML Button" />