in particular the checked being like that rather than in key="value" format?

I've never come across that until just recently in starting to learn HTML5 in detail. I've always used XHTML in the past. Is that why

<input type="checkbox" checked> is so alien to me? Was that kind of thing OK in all previous versions of HTML (not XHTML)? I suspect that's the case.

Thanks.

xhtmlcoder
—
2013-03-29T14:07:03Z —
#2

It is valid in HTML 4.01, and obviously not in XHTML since Attributes may not be minimized in XML. http://www.w3.org/TR/xhtml1/diffs.html#h-4.5. In HTML 4.01, boolean attributes may appear in minimized form - the attribute's value appears alone in the element's start tag.

ralphm
—
2013-03-29T14:35:46Z —
#3

ckecked="checked" ... To quote Jeremy Keith, "This is brought to you by the Department of Redundancy Department". I'm glad that HTML5 has stuck with simple Boolean attributes, like checked, autoplay, controls etc. Much neater.

Stomme_poes
—
2013-03-29T19:40:31Z —
#4

It is of course still okay to use the name-value pairs version in HTML5. The spec allows the shortened version in the cowpaths-paving sense: browsers generally accepted them and honestly don't care; developers care.

I notice I tend to keep with the key-value pairs for consistency: elements having a mixture of types at least look like they were written by one person

felgall
—
2013-03-29T21:34:01Z —
#5

In XHTML5 you must use checked="checked" - all versions of XHTML require the long version or you end up with an error in your page and the rest of the page gets chopped off.

Stomme_poes
—
2013-03-30T08:59:43Z —
#6

Yes, by HTML5 I did mean the non-XML variant.

johnyboy
—
2013-03-31T16:08:25Z —
#7

Right, thanks for confirming that.

zcorpan
—
2013-04-08T21:11:05Z —
#8

<input checked> is equivalent to <input checked=""> i.e. the value is the empty string. The latter syntax is allowed in both HTML and XHTML.

Also, any attribute may use the minimized form (assuming the empty string is a valid value) in HTML these days, not just boolean attributes.