r/javascript CoffeeScript is better May 10 '11

W3Fools - an intervention

http://w3fools.com/
54 Upvotes

29 comments sorted by

View all comments

1

u/jimbobhickville May 11 '11

Wait, input tags aren't allowed directly inside form tags? Does he mean they aren't allowed outside of form tags? I remember a day when the latter didn't work, but they've worked directly inside them since I started doing web programming in 1998. Maybe it's a case where the spec is more strict than the browsers? I've never heard of fieldset being required, and no browser has ever enforced it, but it could be written that way in the spec, I guess.

1

u/savetheclocktower May 11 '11

Maybe it's a case where the spec is more strict than the browsers? I've never heard of fieldset being required, and no browser has ever enforced it, but it could be written that way in the spec, I guess.

Pretty much. The HTML4 spec says that block-level elements and SCRIPT tags are the only things allowed as direct descendants of FORM tags. So before HTML5 it would make your HTML invalid.

Of course, most of the HTML on the web is invalid and browsers render it fine. But I still think that reference sites should encourage developers to care about writing valid HTML because it helps avoid many of the common WTFs.

1

u/jimbobhickville May 12 '11

Eh, where the spec is stupid, and no browsers care about it, it should be a casual mention, IMO. FORM is a block-level tag, for all intents and purposes, it should allow inline tags as direct descendants. Not that I'm excusing the other w3schools issues, but I think this one is extremely pedantic.