Re: [whatwg] Document with a single input[type=radio]?

Mikko Rantalainen writes:

> The spec says in 4.10.5.1.16 Radio Button state (type=radio)
> https://html.spec.whatwg.org/multipage/forms.html#radio-button-state-%28type=radio%29
> 
> "A document must not contain an input element whose radio button group
> contains only that element."
> 
> What this is supposed to mean in practice?

That if you include a radio button group with only one radio button in
it, your document isn't valid HTML.

> Could this sentence be dropped because this does not match real world
> browser behavior?

No, because it isn't a requirement on browsers, so browser behaviour is
irrelevant. It's a requirement on authors.

(It could be dropped for other reasons, of course. I'm not making any
claim either way on whether it's a good requirement on authors; merely
that browser behaviour can't be the reason for dropping it.)

> (A streaming browser will may hit this case after parsing the first
> radio button element in the document. Then what?)

Then browsers will follow the parsing algorithms and treat it
accordingly. For backwards compatibility and interoperability, the spec
covers how to handle all sorts of invalid input that authors might send
them.

Smylers
-- 
http://twitter.com/Smylers2

Received on Thursday, 7 April 2016 12:01:50 UTC